Skip to content

Commit 87ca869

Browse files
authored
Use npm trusted publishing (#303)
1 parent 5a63513 commit 87ca869

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.github/workflows/publish-npm.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
permissions:
1414
contents: read
1515
packages: write
16-
# id-token: write required for get-vault-secrets
16+
# id-token: write required for get-vault-secrets and trusted publishing
1717
id-token: write
1818
outputs:
1919
new_version: ${{ steps.version_check.outputs.version }}
@@ -46,6 +46,9 @@ jobs:
4646
node-version-file: '.nvmrc'
4747
registry-url: 'https://registry.npmjs.org'
4848

49+
- name: Install npm version ^11.5.1 # npm trusted publishing requires version ^11.5.1
50+
run: npm install -g npm@^11.5.1
51+
4952
- name: Install dependencies
5053
if: steps.version_check.outputs.changed == 'true'
5154
run: yarn
@@ -54,18 +57,9 @@ jobs:
5457
if: steps.version_check.outputs.changed == 'true'
5558
run: yarn build
5659

57-
- name: Get secrets from vault
58-
id: get-secrets
59-
uses: grafana/shared-workflows/actions/get-vault-secrets@main
60-
with:
61-
repo_secrets: |
62-
NPM_TOKEN=npm-release:npm_token
63-
6460
- name: Publish package to NPM
6561
if: steps.version_check.outputs.changed == 'true'
6662
run: npm publish --access public --scope grafana
67-
env:
68-
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
6963

7064
- name: Setup .npmrc file for GitHub Packages
7165
if: steps.version_check.outputs.changed == 'true'
@@ -96,7 +90,7 @@ jobs:
9690
- name: Create Release Notes
9791
uses: actions/[email protected]
9892
env:
99-
TAG_NAME: "v${{ needs.npm-publish.outputs.new_version }}"
93+
TAG_NAME: 'v${{ needs.npm-publish.outputs.new_version }}'
10094
with:
10195
github-token: ${{ secrets.GITHUB_TOKEN }}
10296
script: |

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"files": [
2424
"dist"
2525
],
26-
"repository": "github:grafana/grafana-aws-sdk-react",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/grafana/grafana-aws-sdk-react.git"
29+
},
2730
"author": "Grafana Labs <[email protected]> (https://grafana.com)",
2831
"license": "Apache-2.0",
2932
"dependencies": {

0 commit comments

Comments
 (0)