diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a606218d..129c7fe9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,9 @@ name: release +permissions: + id-token: write # Required for NPM trusted publishing + contents: write + on: push: branches: [master] @@ -22,8 +26,9 @@ jobs: - name: Check if version is published id: check run: | + packageName="$( node -e "console.log(require('./package.json').name)" )" currentVersion="$( node -e "console.log(require('./package.json').version)" )" - isPublished="$( npm view @mapbox/node-pre-gyp versions --json | jq -c --arg cv "$currentVersion" 'any(. == $cv)' )" + isPublished="$( npm view $packageName versions --json | jq -c --arg cv "$currentVersion" 'any(. == $cv)' )" echo "version=$currentVersion" >> "$GITHUB_OUTPUT" echo "published=$isPublished" >> "$GITHUB_OUTPUT" echo "currentVersion: $currentVersion" @@ -36,8 +41,6 @@ jobs: needs: release-check if: ${{ needs.release-check.outputs.published == 'false' }} runs-on: ubuntu-latest - permissions: - contents: write defaults: run: shell: bash @@ -47,7 +50,8 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 + registry-url: 'https://registry.npmjs.org' - run: npm ci @@ -90,16 +94,9 @@ jobs: - name: Publish to NPM (release) if: ${{ steps.prepare_release.outputs.prerelease == 'false' }} - run: | - npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}" - npm publish --access public - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --access public - name: Publish to NPM (prerelease) if: ${{ steps.prepare_release.outputs.prerelease == 'true' }} - run: | - npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}" - npm publish --tag next --access public - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --tag next --access public + diff --git a/package.json b/package.json index e1b9e6cd..ec75a6e5 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "author": "Dane Springmeyer ", "repository": { "type": "git", - "url": "git://github.com/mapbox/node-pre-gyp.git" + "url": "https://github.com/mapbox/node-pre-gyp" }, "bin": "./bin/node-pre-gyp", "main": "./lib/node-pre-gyp.js",