Skip to content

Publish NPM

Publish NPM #169

Workflow file for this run

name: Publish NPM
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Setup to publish to npm Packages
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/checkout@v4
# Checout submodule
- name: Checkout submodules
run: git submodule update --init --remote --recursive
- run: npm ci
# Build
- run: npm run build
# Determine if this is a pre-release
- name: Check if pre-release
id: tag
run: |
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "::set-output name=TAG::prerelease"
else
echo "::set-output name=TAG::latest"
fi
# Publish to npm
- name: Publish to npm
run: npm publish --access public --tag ${{ steps.tag.outputs.TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Setup to publish to GitHub Packages
- uses: actions/setup-node@v4
with:
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@revolist'
# Publish to GitHub Packages
- name: Publish to GitHub Packages
run: npm publish --access public --tag ${{ steps.tag.outputs.TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Update packages with new version
- name: Sync packages
run: npm run package:update