Publish Package #36
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 Package | |
permissions: | |
id-token: write | |
# contents: write | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Use Node.js v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
cache: pnpm | |
- run: pnpm install --frozen-lockfile | |
- name: Set publish args if beta version | |
run: | | |
if grep -q "-beta" package.json; then | |
echo "PUBLISH_ARGS=--tag beta" >> $GITHUB_ENV | |
echo "This is a beta version 🅱️" | |
fi | |
- name: Publish to npm | |
run: npm publish --access public $PUBLISH_ARGS | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
NPM_CONFIG_PROVENANCE: true |