Skip to content

0.5.2

0.5.2 #14

Workflow file for this run

name: Publish to NPM
on:
push:
branches:
- main
jobs:
check:
name: Check commit message
runs-on: ubuntu-24.04
outputs:
commit_message: ${{ steps.check_commit_message.outputs.commit_message }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check commit message
id: check_commit_message
run: |
commit_message=$(git log --format=%B -n 1 ${{ github.sha }})
if [[ $commit_message =~ ^[0-9]+\.[0-9]+\.[0-9] ]]; then
echo "Commit message matches version format."
echo "commit_message=$commit_message" >> "$GITHUB_OUTPUT"
else
echo "Commit message does not match version format. Skipping release."
fi
build-and-publish:
name: Build and publish npm package
needs: [check]
if: ${{ needs.check.outputs.commit_message != '' }}
runs-on: ubuntu-24.04
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}