Skip to content

Commit e6e6755

Browse files
committed
Use vault to get npm token
1 parent 0e30a1d commit e6e6755

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/publish-npm.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ jobs:
88
npm-publish:
99
name: Publish to NPM & GitHub Package Registry
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
# id-token: write required for get-vault-secrets
14+
id-token: write
1115
outputs:
1216
new_version: ${{ steps.version_check.outputs.version }}
1317
version_changed: ${{ steps.version_check.outputs.changed }}
@@ -43,11 +47,18 @@ jobs:
4347
if: steps.version_check.outputs.changed == 'true'
4448
run: yarn build
4549

50+
- name: Get secrets from vault
51+
id: get-secrets
52+
uses: grafana/shared-workflows/actions/get-vault-secrets@main
53+
with:
54+
repo_secrets: |
55+
NPM_TOKEN=npm-release.npm_token
56+
4657
- name: Publish package to NPM
4758
if: steps.version_check.outputs.changed == 'true'
4859
run: npm publish --access public --scope grafana
4960
env:
50-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
5162

5263
- name: Setup .npmrc file for GitHub Packages
5364
if: steps.version_check.outputs.changed == 'true'

0 commit comments

Comments
 (0)