Skip to content

Manual Publish Package #55

Manual Publish Package

Manual Publish Package #55

Workflow file for this run

name: Manual Publish Package
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true
prerelease:
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
type: boolean
required: true
release_highlight:
description: 'Should release @highlight-run/... packages.'
type: boolean
required: true
release_launchdarkly:
description: 'Should release @launchdarkly/... packages.'
type: boolean
required: true
release_launchdarkly_python:
description: 'Should release @launchdarkly/observability-python package.'
type: boolean
required: true
python_tag_name:
description: 'The tag name for the python package. Should be set when publishing a python package.'
type: string
required: false
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
issues: read
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish-package:
if: ${{ inputs.release_highlight == true || inputs.release_launchdarkly == true }}
runs-on: ubuntu-22.04-8core-32gb
steps:
- name: Checkout
uses: actions/checkout@v4
- run: git submodule update --init --recursive
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
- name: Install js dependencies
run: yarn install
- name: Build & test
run: yarn test
env:
NEXT_PUBLIC_HIGHLIGHT_PROJECT_ID: 1jdkoe52
REACT_APP_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Configure yarn npm registry credentials for highlight
if: ${{ inputs.release_highlight == true }}
run: |
yarn config set npmRegistryServer "https://registry.npmjs.org"
yarn config set npmAuthToken "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_HIGHLIGHT_RUN }}
- name: Publish highlight npm packages
if: ${{ inputs.release_highlight == true }}
id: changesets-publish
run: yarn publish:highlight
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
if: ${{ inputs.release_launchdarkly == true }}
name: 'Get NPM token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN'
- name: Configure yarn npm registry credentials for launchdarkly
if: ${{ inputs.release_launchdarkly == true }}
run: |
yarn config set npmRegistryServer "https://registry.npmjs.org"
yarn config set npmAuthToken "${NODE_AUTH_TOKEN}"
- name: Publish
if: ${{ inputs.release_launchdarkly == true }}
shell: bash
run: ./scripts/publish-npm.sh
env:
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry-run }}
publish-python-sdk:
runs-on: ubuntu-latest
if: ${{ inputs.release_launchdarkly_python == true }}
permissions:
id-token: write # Used for publishing secrets and documentation.
outputs:
package-hashes: ${{ steps.publish.outputs.package-hashes }}
steps:
- name: Checkout
uses: actions/checkout@v4
- run: git submodule update --init --recursive
- name: Publish Python SDK
id: publish
uses: ./.github/actions/publish-python-sdk
with:
workspace-path: sdk/@launchdarkly/observability-python
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
publish-python-provenance:
needs: ['publish-python-sdk']
if: ${{ inputs.release_launchdarkly_python == true }}
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: '${{ needs.publish-python-sdk.outputs.package-hashes }}'
upload-assets: true
upload-tag-name: ${{ inputs.python_tag_name }}