Skip to content

Publish to NPM

Publish to NPM #14

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Publish to NPM
on:
push:
branches: ["main"]
pull_request:
branches: "*"
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
# big
if: |
contains(github.event.head_commit.message, 'feat') ||
contains(github.event.head_commit.message, 'fix') ||
contains(github.event.head_commit.message, 'docs') ||
contains(github.event.head_commit.message, 'perf') ||
contains(github.event.head_commit.message, 'build') ||
contains(github.event.head_commit.message, 'ci') ||
contains(github.event_name, 'workflow_dispatch')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- run: npm install -g pnpm
- name: Determine pnpm store path
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
${{ runner.os }}-pnpm-store-
${{ runner.os }}-pnpm-
- name: PNPM Install
run: pnpm install
- name: Typescript Linting and Checking
run: npm run lint
- name: ESBuild
run: npm run build
- name: Publish to NPM
run: npm run semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
pages: write
id-token: write