Publish a package #16
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: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Using Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Update npm version to latest | |
run: npm install -g npm@latest | |
- name: Install dependencies | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | |
npm install | |
env: | |
NODE_AUTH_TOKEN: ${{github.token}} | |
- name: Compile | |
run: npm run build | |
- name: Run tests | |
run: npm run test | |
publish-gh: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: "https://registry.npmjs.org" | |
scope: "@${{github.repository_owner}}" | |
- run: npm install | |
- run: | | |
npm config set @${{github.repository_owner}}:registry https://npm.pkg.github.com | |
npm config set //npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.PAT}} | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: "https://registry.npmjs.org" | |
scope: "@${{github.repository_owner}}" | |
- run: npm install | |
env: | |
NODE_AUTH_TOKEN: ${{github.token}} | |
- run: | | |
npm config set @${{github.repository_owner}}:registry https://registry.npmjs.org | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |