Skip to content

Publish package to NPM and Github Packages #5

Publish package to NPM and Github Packages

Publish package to NPM and Github Packages #5

name: Publish package to NPM and Github Packages
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
publish-gpr:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-npm:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}