Skip to content

Publish

Publish #14

Workflow file for this run

name: Publish
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
"${{ runner.os }}-pnpm-store-"
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Install dependencies
run: pnpm i --ignore-scripts --frozen-lockfile
- name: Build
run: pnpm build
- name: Publish package
run: |
TAG=$(echo ${{github.ref_name}} | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
pnpm publish --access public --tag ${TAG:-latest} --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}