Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

fix(workflow): restructure build jobs to separate lint and test steps… #10

fix(workflow): restructure build jobs to separate lint and test steps…

fix(workflow): restructure build jobs to separate lint and test steps… #10

Workflow file for this run

name: Build & Release
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
version:
description: "Version type (patch, minor, major, or specific version)"
required: false
type: string
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 20
- run: npm ci
- run: npm run jake lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20, 22, 24, 25]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
publish:
runs-on: ubuntu-24.04
needs: [lint, test]
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
id-token: write # Required for OIDC trusted publishing
contents: write # Required to push tags and create releases
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0 # Need full history for version tags
# setup-node with registry-url is required for OIDC trusted publishing
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
- name: Set up SSH signing
uses: photostructure/git-ssh-signing-action@fdd4b062a9ba41473f013258cc9c7eea1640f826 # v1.2.0
with:
ssh-signing-key: ${{ secrets.SSH_SIGNING_KEY }}
git-user-name: ${{ secrets.GIT_USER_NAME }}
git-user-email: ${{ secrets.GIT_USER_EMAIL }}
- name: Update npm to latest to get --provenance support
run: |
npm install -g npm@latest
npm --version
- name: Install dependencies
run: npm ci
- name: Build
run: npm run jake build
- name: Bump version and create tag
run: |
VERSION_ARG="${{ github.event.inputs.version }}"
if [ -z "$VERSION_ARG" ]; then
VERSION_ARG="patch"
fi
npm version "$VERSION_ARG" --sign-git-tag -m "chore(release): %s"
echo "NEW_VERSION=$(npm pkg get version | tr -d '\"')" >> $GITHUB_ENV
- name: Push changes and tags
run: |
git push origin main
git push origin --tags
- name: Create GitHub Release
run: gh release create "v${{ env.NEW_VERSION }}" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm with OIDC
run: npm publish --provenance