v2.5.3 #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
# Requires repo secret: NPM_TOKEN ("automation" access token) | |
name: Node.js Publish | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
node-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
# actions/checkout@v4 | |
contents: read | |
# `npm publish --provenance` | |
id-token: write | |
# thollander/actions-comment-pull-request@v2 | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
with: | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm ci | |
- id: publish | |
name: npm publish | |
run: | | |
set -x | |
npm whoami | |
npm publish | |
{ | |
echo "PACKAGE_NAME=$(jq --raw-output '.name' package.json)" | |
echo "PACKAGE_VERSION=$(jq --raw-output '.version' package.json)" | |
} >> "${GITHUB_OUTPUT}" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Comment back on the PR that caused this push | |
- id: pr-finder | |
run: | | |
GIT_SHA=$(git rev-parse HEAD) | |
echo "${GIT_SHA}" | |
PR_NUMBER=$(curl -L \ | |
--fail-with-body \ | |
--silent \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GIT_SHA}/pulls" \ | |
| jq --raw-output '.[0].number') | |
echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_OUTPUT}" | |
- uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
## :package: npm publish | |
This pull request resulted in the npm release: [v${{ steps.publish.outputs.PACKAGE_VERSION }}](https://www.npmjs.com/package/${{ steps.publish.outputs.PACKAGE_NAME }}/v/${{ steps.publish.outputs.PACKAGE_VERSION }}) | |
_Comment generated by the [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) workflow._ | |
comment_tag: node-publish | |
pr_number: ${{ steps.pr-finder.outputs.PR_NUMBER }} |