v3.0.1 #8
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
name: Publish a package | |
on: | |
release: | |
types: [released] | |
jobs: | |
publish-gh: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com | |
scope: "@${{github.repository_owner}}" | |
- run: | | |
npm config set //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | |
npm install | |
env: | |
NODE_AUTH_TOKEN: ${{github.token}} | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.PAT}} | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org" | |
scope: "@${{github.repository_owner}}" | |
- run: | | |
npm config set //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | |
npm install | |
env: | |
NODE_AUTH_TOKEN: ${{github.token}} | |
- run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
declare repo_name=$(echo "${{github.repository}}" | cut -d '/' -f 2) | |
declare temp_npmrc="/home/runner/work/$repo_name/$repo_name/.npmrc" | |
truncate $temp_npmrc -s 0 | |
echo "@${{github.repository_owner}}:registry=https://registry.npmjs.org" >> $temp_npmrc | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |