Skip to content

Commit e6bff35

Browse files
authored
Use npm trusted publishing (#169)
1 parent 04458f7 commit e6bff35

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ on:
44
branches:
55
- main
66

7+
permissions: {}
8+
79
jobs:
810
npm-publish:
911
name: Publish to NPM & GitHub Package Registry
1012
runs-on: ubuntu-latest
13+
# Required for this workflow to have permission to publish NPM packages
14+
environment: release
1115
outputs:
1216
new_version: ${{ steps.version_check.outputs.version }}
1317
version_changed: ${{ steps.version_check.outputs.changed }}
1418
permissions:
1519
contents: write
16-
# id-token: write is required for the get-vault-secrets step
20+
# id-token: write required for npm trusted publishing
1721
id-token: write
1822
steps:
1923
- name: Checkout repository
@@ -43,6 +47,10 @@ jobs:
4347
node-version-file: '.nvmrc'
4448
registry-url: 'https://registry.npmjs.org'
4549

50+
- name: Install npm version ^11.5.1 # npm trusted publishing requires version ^11.5.1
51+
if: steps.version_check.outputs.changed == 'true'
52+
run: npm install -g npm@^11.5.1
53+
4654
- name: Install dependencies
4755
if: steps.version_check.outputs.changed == 'true'
4856
run: yarn
@@ -51,18 +59,9 @@ jobs:
5159
if: steps.version_check.outputs.changed == 'true'
5260
run: yarn build
5361

54-
- name: Get secrets from vault
55-
id: get-secrets
56-
uses: grafana/shared-workflows/actions/get-vault-secrets@main
57-
with:
58-
repo_secrets: |
59-
NPM_TOKEN=npm-release:npm_token
60-
6162
- name: Publish package to NPM
6263
if: steps.version_check.outputs.changed == 'true'
63-
run: npm publish --access public --scope grafana
64-
env:
65-
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
64+
run: npm publish --access public
6665

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

0 commit comments

Comments
 (0)