Skip to content

Release npm package

Release npm package #3

Workflow file for this run

name: Release npm package
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
jobs:
pkg:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '21.x'
registry-url: https://registry.npmjs.org/
- name: Release npm package
if: startsWith(github.ref, 'refs/tags/')
run: |
npm install
npm config set //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
echo "appthreat:registry=https://npm.pkg.github.com" > ~/.npmrc
npm publish --access=public --@appthreat:registry='https://npm.pkg.github.com'
echo "appthreat:registry=https://registry.npmjs.org" > ~/.npmrc
npm publish --provenance --access=public --@appthreat:registry='https://registry.npmjs.org'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}