Skip to content

Merge pull request #588 from devswha/dev #12

Merge pull request #588 from devswha/dev

Merge pull request #588 from devswha/dev #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
publish:
description: Publish npm packages instead of running a dry-run.
type: boolean
default: false
publish_ghcr:
description: Also publish the experimental GHCR image. Keep false for npm-only releases.
type: boolean
default: false
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node 20
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Release metadata check
run: npm run release:check
- name: Unit and e2e tests
run: npm test
- name: Benchmark report schema
run: npm run benchmark:report
- name: Detector comparison harness
# Runs before the drift check so the regenerated
# docs/benchmarks/detector-comparison.{json,md} are drift-checked too.
run: npm run benchmark:compare
- name: Benchmark report drift check
# Same deterministic regen as test.yml's quality job (timestamp and
# node-version metadata lines ignored); a failure here means the
# tagged commit ships a stale public benchmark page.
run: |
git diff --exit-code -I '"generatedAt":' -I '"benchmarkGeneratedAt":' -I 'Generated at:' -I '"nodeVersion":' -I '^- Node: ' -- docs/benchmarks || {
echo '::error::docs/benchmarks is stale. Run `npm run benchmark:report && npm run benchmark:compare` and commit the result.'
exit 1
}
- name: Dogfood public docs
run: npm run dogfood
- name: Private asset leak gate
run: npm run check:no-private-assets
- name: Root npm package dry run
run: npm pack --dry-run
- name: Alias npm package dry run
run: cd packages/patina-humanizer && npm pack --dry-run
npm:
needs: verify
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.publish == true)
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Set up Node 20 for npm
uses: actions/setup-node@v6
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify release metadata
run: npm run release:check
- name: Publish patina-cli
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public --provenance
- name: Publish patina-humanizer alias
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: cd packages/patina-humanizer && npm publish --access public --provenance
ghcr:
needs: verify
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.publish_ghcr == true
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/devswha/patina
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
- name: Build and publish image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}