Publish Package #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package | |
on: | |
workflow_dispatch: | |
inputs: | |
workspace_path: | |
description: 'The workspace to publish' | |
required: true | |
default: 'packages/shared/common' | |
type: choice | |
options: | |
- packages/shared/common | |
- packages/shared/sdk-client | |
- packages/shared/sdk-server | |
- packages/shared/sdk-server-edge | |
- packages/shared/akamai-edgeworker-sdk | |
- packages/sdk/cloudflare | |
- packages/sdk/react-native | |
- packages/sdk/server-node | |
- packages/sdk/vercel | |
- packages/sdk/akamai-base | |
- packages/sdk/akamai-edgekv | |
- packages/store/node-server-sdk-redis | |
- packages/store/node-server-sdk-dynamodb | |
- packages/telemetry/node-server-sdk-otel | |
prerelease: | |
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.' | |
type: boolean | |
required: true | |
dry_run: | |
description: 'Is this a dry run. If so no package will be published.' | |
type: boolean | |
required: true | |
jobs: | |
build-publish: | |
runs-on: ubuntu-latest | |
# Needed to get tokens during publishing. | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
registry-url: 'https://registry.npmjs.org' | |
- uses: ./actions/install-npm-version | |
with: | |
npm_version: 9.5.0 | |
- name: 'Setup Redis' | |
if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-redis' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install redis-server | |
sudo service redis-server start | |
- name: 'Setup DynamoDB' | |
if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-dynamodb' }} | |
run: | | |
sudo docker run -d -p 8000:8000 amazon/dynamodb-local | |
- name: 'Set WORKSPACE_NAME variable' | |
run: | | |
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }}) | |
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV | |
- id: build-and-test | |
# Build using the same steps from CI. | |
name: Build and Test | |
uses: ./actions/ci | |
with: | |
workspace_name: ${{ env.WORKSPACE_NAME }} | |
workspace_path: ${{ inputs.workspace_path }} | |
- uses: ./actions/release-secrets | |
name: 'Get NPM token' | |
with: | |
aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | |
ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN' | |
- name: Setup .yarnrc.yml | |
shell: bash | |
run: | | |
yarn config set npmScopes.launchdarkly.npmRegistryServer "https://registry.npmjs.org" | |
yarn config set npmScopes.launchdarkly.npmAlwaysAuth true | |
yarn config set npmScopes.launchdarkly.npmAuthToken $NODE_AUTH_TOKEN | |
- id: publish | |
name: Publish Package | |
uses: ./actions/publish | |
with: | |
workspace_name: ${{ env.WORKSPACE_NAME }} | |
workspace_path: ${{ inputs.workspace_path }} | |
prerelease: ${{ inputs.prerelease }} | |
dry_run: ${{ inputs.dry_run }} |