Correcting Github references in package.json #17
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
name: Node.js Package | |
on: push | |
jobs: | |
publish-gpr: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: https://npm.pkg.github.com/ | |
- run: npm ci | |
- run: npm run build | |
- name: Modify package.json for local context | |
# Values in package.json must match the current GitHub repository to | |
# publish to it. | |
run: | | |
npm exec -- json -I -f package.json -e "this.name='@$GITHUB_REPOSITORY'" | |
npm exec -- json -I -f package.json -e "this.repository='https://github.com/$GITHUB_REPOSITORY'" | |
- name: Release NPM package | |
# The latest tag follows tagged versions to follow NPM conventions. | |
run: | | |
npm version ${{ env.NPM_VERSION }} --no-git-tag-version | |
cat package.json | |
npm publish --tag latest | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |