Publish to GitHub Packages #13
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: Publish to GitHub Packages | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
publish-gpr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@gitset-dev' | |
- name: Update package name for GitHub Packages | |
run: | | |
cp package.json package.json.backup | |
npm pkg set name=@gitset-dev/gitset/cli | |
- name: Publish to GitHub Packages | |
run: | | |
echo "registry=https://npm.pkg.github.com" > .npmrc | |
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc | |
npm publish --registry=https://npm.pkg.github.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- name: Restore original package.json | |
run: mv package.json.backup package.json |