Skip to content

Commit 6eb3ca5

Browse files
committed
chore: update npm publishing to use OIDC authentication
This updates the CI workflow to use OIDC authentication for npm publishing instead of static tokens. This is more secure and follows GitHub's recommended practices. Changes: - Added 'permissions: id-token: write' to publish job - Removed NPM_TOKEN environment variable from publish job - Removed 'npm config set' command that configured static token authentication - Updated npm publish commands to use 'npx -y npm@latest publish' wrapped in a publish() function - Preserved all existing jobs, steps, conditions, and INTERCOM_API_KEY environment variable
1 parent 38db2d6 commit 6eb3ca5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
needs: [ compile, test ]
3939
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
4040
runs-on: ubuntu-latest
41+
permissions:
42+
id-token: write
4143
steps:
4244
- name: Checkout repo
4345
uses: actions/checkout@v3
@@ -50,13 +52,13 @@ jobs:
5052

5153
- name: Publish to npm
5254
run: |
53-
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
55+
publish() {
56+
npx -y npm@latest publish "$@"
57+
}
5458
if [[ ${GITHUB_REF} == *alpha* ]]; then
55-
npm publish --access public --tag alpha
59+
publish --access public --tag alpha
5660
elif [[ ${GITHUB_REF} == *beta* ]]; then
57-
npm publish --access public --tag beta
61+
publish --access public --tag beta
5862
else
59-
npm publish --access public
60-
fi
61-
env:
62-
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
63+
publish --access public
64+
fi

0 commit comments

Comments
 (0)