Skip to content

Commit d1efbf3

Browse files
authored
chore(DX-809): update to use preferred OIDC for npm publish in github actions (#542)
2 parents b009012 + 12daa5c commit d1efbf3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/deploy-sdk.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches: [main] # all branches where deployments currently occur. Make sure this list matches list of branches in `.releaserc` file.
88

99
permissions:
10+
id-token: write
1011
contents: write # access to push the git tag
1112
issues: write # Bot creates an issue if there is an issue during deployment process
1213
pull-requests: write # allow bot to make comments on PRs after they get deployed
@@ -122,6 +123,7 @@ jobs:
122123
name: Deploy to npm
123124
needs: [deploy-git-tag]
124125
if: needs.deploy-git-tag.outputs.new_release_published == 'true' # only run if a git tag was made.
126+
environment: release
125127
runs-on: ubuntu-latest
126128
steps:
127129
- uses: actions/checkout@v4
@@ -132,14 +134,19 @@ jobs:
132134
with:
133135
node-version: '20'
134136
cache: 'npm'
137+
registry-url: 'https://registry.npmjs.org'
135138

136-
- run: npm ci
139+
- name: Install npm 11.5.1+ for OIDC support
140+
run: npm install -g npm@latest
137141

138-
- name: Deploy to npm
139-
run: ./scripts/deploy-code.sh
140-
env:
141-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
142-
IS_PRERELEASE: false # at this time, all deployments are made to `main` production branch
142+
- name: Install dependencies
143+
run: npm ci
144+
145+
- name: Run pre-deploy
146+
run: npm run pre-deploy
147+
148+
- name: Publish to npm
149+
run: npm publish --tag latest
143150

144151
- name: Notify team of successful deployment
145152
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0

0 commit comments

Comments
 (0)