Skip to content

Commit 2399ec6

Browse files
committed
chore: Move to OIDC authentication for NPM publishing.
1 parent b4f8f19 commit 2399ec6

File tree

4 files changed

+138
-129
lines changed

4 files changed

+138
-129
lines changed

.github/workflows/manual-publish.yml

Lines changed: 0 additions & 117 deletions
This file was deleted.

.github/workflows/release-please.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,81 @@
1+
# This workflow handles both automated and manual package publishing:
2+
#
3+
# AUTOMATED PUBLISHING (on push to main):
4+
# - Triggered automatically when changes are pushed to the main branch
5+
# - Uses release-please to create releases based on conventional commits
6+
# - Publishes packages to npm automatically when release PRs are merged
7+
# - All release-* jobs run in dependency order based on package dependencies
8+
#
9+
# MANUAL PUBLISHING (via workflow_dispatch):
10+
# - Can be triggered manually from the Actions tab
11+
# - Allows publishing a specific package to npm or jsr
12+
# - Supports prerelease and dry-run modes
13+
# - Runs the manual-publish job which builds, tests, and publishes the selected package
14+
# - Primarily used for pre-release jobs, or to correct publishing errors during the automated process
15+
#
16+
# The workflow uses conditional logic to ensure only the appropriate jobs run:
17+
# - release-please job: only runs on push events
18+
# - release-* jobs: only run on push events when their package has a new release
19+
# - manual-publish job: only runs on workflow_dispatch events
120
on:
221
push:
322
branches:
423
- main
24+
workflow_dispatch:
25+
inputs:
26+
package_registry:
27+
description: 'Publish to'
28+
required: true
29+
default: 'npm'
30+
type: choice
31+
options:
32+
- npm
33+
- jsr
34+
workspace_path:
35+
description: 'The workspace to publish'
36+
required: true
37+
default: 'packages/shared/common'
38+
type: choice
39+
options:
40+
- packages/shared/common
41+
- packages/shared/sdk-client
42+
- packages/shared/sdk-server
43+
- packages/shared/sdk-server-edge
44+
- packages/shared/akamai-edgeworker-sdk
45+
- packages/sdk/cloudflare
46+
- packages/sdk/fastly
47+
- packages/sdk/react-native
48+
- packages/sdk/server-node
49+
- packages/sdk/react-universal
50+
- packages/sdk/vercel
51+
- packages/sdk/akamai-base
52+
- packages/sdk/akamai-edgekv
53+
- packages/store/node-server-sdk-redis
54+
- packages/store/node-server-sdk-dynamodb
55+
- packages/telemetry/node-server-sdk-otel
56+
- packages/tooling/jest
57+
- packages/sdk/browser
58+
- packages/sdk/server-ai
59+
- packages/ai-providers/server-ai-openai
60+
- packages/ai-providers/server-ai-vercel
61+
- packages/ai-providers/server-ai-langchain
62+
- packages/telemetry/browser-telemetry
63+
- packages/sdk/combined-browser
64+
- packages/sdk/shopify-oxygen
65+
prerelease:
66+
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
67+
type: boolean
68+
required: true
69+
dry_run:
70+
description: 'Is this a dry run. If so no package will be published.'
71+
type: boolean
72+
required: true
573
name: release-please
674

775
jobs:
876
release-please:
977
runs-on: ubuntu-latest
78+
if: github.event_name == 'push'
1079
outputs:
1180
package-common-released: ${{ steps.release.outputs['packages/shared/common--release_created'] }}
1281
package-sdk-client-released: ${{ steps.release.outputs['packages/shared/sdk-client--release_created'] }}
@@ -544,3 +613,56 @@ jobs:
544613
with:
545614
workspace_path: packages/sdk/shopify-oxygen
546615
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
616+
617+
manual-publish:
618+
runs-on: ubuntu-latest
619+
if: github.event_name == 'workflow_dispatch'
620+
permissions:
621+
id-token: write
622+
contents: read
623+
steps:
624+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
625+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
626+
with:
627+
node-version: 24.x
628+
registry-url: 'https://registry.npmjs.org'
629+
- name: 'Setup Redis'
630+
if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-redis' }}
631+
run: |
632+
sudo apt-get update
633+
sudo apt-get install redis-server
634+
sudo service redis-server start
635+
636+
- name: 'Setup DynamoDB'
637+
if: ${{ inputs.workspace_path == 'packages/store/node-server-sdk-dynamodb' }}
638+
run: |
639+
sudo docker run -d -p 8000:8000 amazon/dynamodb-local
640+
641+
- name: 'Set WORKSPACE_NAME variable'
642+
run: |
643+
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
644+
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
645+
- id: build-and-test
646+
name: Build and Test
647+
uses: ./actions/ci
648+
with:
649+
workspace_name: ${{ env.WORKSPACE_NAME }}
650+
workspace_path: ${{ inputs.workspace_path }}
651+
- id: publish-jsr
652+
name: Publish Package to jsr
653+
if: ${{ inputs.package_registry == 'jsr' }}
654+
uses: ./actions/publish-jsr
655+
with:
656+
workspace_name: ${{ env.WORKSPACE_NAME }}
657+
workspace_path: ${{ inputs.workspace_path }}
658+
dry_run: ${{ inputs.dry_run }}
659+
# Publishing credentials for NPM come from OIDC.
660+
- id: publish-npm
661+
name: Publish Package to npm
662+
if: ${{ inputs.package_registry == 'npm' }}
663+
uses: ./actions/publish
664+
with:
665+
workspace_name: ${{ env.WORKSPACE_NAME }}
666+
workspace_path: ${{ inputs.workspace_path }}
667+
prerelease: ${{ inputs.prerelease }}
668+
dry_run: ${{ inputs.dry_run }}

actions/full-release/action.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,12 @@ runs:
2020
with:
2121
workspace_name: ${{ env.WORKSPACE_NAME }}
2222
workspace_path: ${{ inputs.workspace_path }}
23-
- uses: ./actions/release-secrets
24-
name: 'Get NPM token'
25-
with:
26-
aws_assume_role: ${{ inputs.aws_assume_role }}
27-
ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN'
28-
- name: Setup .yarnrc.yml
29-
shell: bash
30-
run: |
31-
yarn config set npmScopes.launchdarkly.npmRegistryServer "https://registry.npmjs.org"
32-
yarn config set npmScopes.launchdarkly.npmAlwaysAuth true
33-
yarn config set npmScopes.launchdarkly.npmAuthToken $NODE_AUTH_TOKEN
3423
- uses: ./actions/publish-jsr
3524
with:
3625
workspace_name: ${{ env.WORKSPACE_NAME }}
3726
workspace_path: ${{ inputs.workspace_path }}
3827
dry_run: false
28+
# Publishing credentials for NPM come from OIDC.
3929
- uses: ./actions/publish
4030
with:
4131
workspace_name: ${{ env.WORKSPACE_NAME }}

contributing/publishing.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ phases: initial package publishing phase and stable release phase.
88
> still read through the [initial publishing](#initial-package-publishing)
99
> and follow the relevant steps to initialize the CI implementation.
1010
11+
## Publishing Workflows
12+
13+
This repository uses the [`release-please.yml`](../.github/workflows/release-please.yml) workflow for all publishing operations:
14+
15+
- **Automated Publishing**: When changes are pushed to `main`, release-please automatically creates release PRs based on conventional commits. When these PRs are merged, packages are automatically published to npm.
16+
17+
- **Manual Publishing**: The workflow can be triggered manually via the GitHub Actions UI to publish a specific package. This is useful for:
18+
- Pre-release versions
19+
- Hotfixes or backports
20+
- Correcting publishing errors
21+
- Publishing to JSR (JavaScript Registry)
22+
23+
Manual triggers support prerelease flags and dry-run mode.
24+
1125
## Initial Package Publishing
1226

1327
When publishing a package for the first time, developers must complete several steps not part of a typical package release. This phase is
@@ -48,7 +62,7 @@ Add the following to `.release-please-manifest.json`
4862
Add `PATH_TO_YOUR_PACKAGE` to the `on.workflow_dispatch.inputs.workspace_path.options`
4963
array in the following files:
5064
- [`manual-publish-docs.yml`](../.github/workflows/manual-publish-docs.yml)
51-
- [`manual-publish.yml`](../.github/workflows/manual-publish.yml)
65+
- [`release-please.yml`](../.github/workflows/release-please.yml) (manual publishing section)
5266

5367
## 4. Create a CI non-release workflow for just the project
5468

0 commit comments

Comments
 (0)