From e5662993e53004e5db1c9da1f94f79c3ee4eb6d7 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Fri, 3 Oct 2025 13:08:52 -0700 Subject: [PATCH] Use npm trusted publishing --- .github/workflows/publish-npm.yml | 16 +++++----------- package.json | 5 ++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 7249efc..8a704a5 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -13,7 +13,7 @@ jobs: permissions: contents: read packages: write - # id-token: write required for get-vault-secrets + # id-token: write required for get-vault-secrets and trusted publishing id-token: write outputs: new_version: ${{ steps.version_check.outputs.version }} @@ -46,6 +46,9 @@ jobs: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' + - name: Install npm version ^11.5.1 # npm trusted publishing requires version ^11.5.1 + run: npm install -g npm@^11.5.1 + - name: Install dependencies if: steps.version_check.outputs.changed == 'true' run: yarn @@ -54,18 +57,9 @@ jobs: if: steps.version_check.outputs.changed == 'true' run: yarn build - - name: Get secrets from vault - id: get-secrets - uses: grafana/shared-workflows/actions/get-vault-secrets@main - with: - repo_secrets: | - NPM_TOKEN=npm-release:npm_token - - name: Publish package to NPM if: steps.version_check.outputs.changed == 'true' run: npm publish --access public --scope grafana - env: - NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }} - name: Setup .npmrc file for GitHub Packages if: steps.version_check.outputs.changed == 'true' @@ -96,7 +90,7 @@ jobs: - name: Create Release Notes uses: actions/github-script@v7.0.1 env: - TAG_NAME: "v${{ needs.npm-publish.outputs.new_version }}" + TAG_NAME: 'v${{ needs.npm-publish.outputs.new_version }}' with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/package.json b/package.json index 2d2efc4..43e04e8 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,10 @@ "files": [ "dist" ], - "repository": "github:grafana/grafana-aws-sdk-react", + "repository": { + "type": "git", + "url": "https://github.com/grafana/grafana-aws-sdk-react.git" + }, "author": "Grafana Labs (https://grafana.com)", "license": "Apache-2.0", "dependencies": {