Skip to content

chore: release v0.5.0 (#198) #89

chore: release v0.5.0 (#198)

chore: release v0.5.0 (#198) #89

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
publish:
description: 'Set to "true" to publish package to npmjs.org'
required: false
type: boolean
release:
types: [published]
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
version_no_v: ${{ steps.normalize_version.outputs.version_no_v }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: '10.15.0'
- name: Ensure pnpm is available (fallback)
run: |
if ! command -v pnpm >/dev/null 2>&1; then
corepack enable || true
corepack prepare pnpm@10.15.0 --activate || true
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Install Playwright browsers
run: |
pnpm --filter @pair/brand exec playwright install --with-deps chromium
pnpm --filter @pair/website exec playwright install --with-deps chromium
- name: Run quality checks
run: pnpm quality-gate
- name: Run E2E tests
run: pnpm --filter @pair/website e2e
- name: Build all packages
run: pnpm build
- name: Determine version
id: version
run: |
chmod +x scripts/workflows/release/determine-version.sh
./scripts/workflows/release/determine-version.sh \
--input-version "${{ github.event.inputs.version }}" \
--release-tag "${{ github.event.release.tag_name }}" \
--github-ref "$GITHUB_REF" \
--output-file $GITHUB_OUTPUT \
--env-file $GITHUB_ENV
- name: Normalize version for filenames
id: normalize_version
run: |
# Strip a leading 'v' from the version if present so filenames match scripts that expect no leading v
RAW='${{ steps.version.outputs.version }}'
# If RAW is empty (rare), fall back to github input/version
if [ -z "$RAW" ]; then
RAW='${{ github.event.inputs.version || github.event.release.tag_name || github.ref }}'
fi
# Remove leading 'v' or 'V'
NORM=${RAW#v}
NORM=${NORM#V}
echo "version_no_v=$NORM" >> $GITHUB_OUTPUT
- name: Create manual release artifacts
run: |
chmod +x scripts/workflows/release/package-manual.sh
./scripts/workflows/release/package-manual.sh ${{ steps.normalize_version.outputs.version_no_v }}
- name: Create knowledge base dataset release artifact
run: |
chmod +x scripts/workflows/release/package-kb-dataset.sh
./scripts/workflows/release/package-kb-dataset.sh ${{ steps.normalize_version.outputs.version_no_v }}
- name: Upload release artifacts as workflow artifacts
uses: actions/upload-artifact@v4
with:
name: pair-cli-manual-${{ steps.normalize_version.outputs.version_no_v }}
path: |
release/pair-cli-manual-${{ steps.normalize_version.outputs.version_no_v }}.zip
release/pair-cli-manual-${{ steps.normalize_version.outputs.version_no_v }}.zip.sha256
retention-days: 30
- name: Upload knowledge base dataset artifact
uses: actions/upload-artifact@v4
with:
name: knowledge-base-dataset-${{ steps.normalize_version.outputs.version_no_v }}
path: |
release/knowledge-base-${{ steps.normalize_version.outputs.version_no_v }}.zip
release/knowledge-base-${{ steps.normalize_version.outputs.version_no_v }}.zip.sha256
retention-days: 30
- name: Create registry TGZ from manual release folder
run: |
chmod +x scripts/workflows/release/create-registry-tgz.sh
./scripts/workflows/release/create-registry-tgz.sh ${{ steps.normalize_version.outputs.version_no_v }} release/pair-cli-manual-${{ steps.normalize_version.outputs.version_no_v }}.zip
- name: Upload TGZ artifact as workflow artifact
uses: actions/upload-artifact@v4
with:
name: pair-cli-tgz-${{ steps.normalize_version.outputs.version_no_v }}
path: |
release/pair-cli-${{ steps.normalize_version.outputs.version_no_v }}.tgz
release/pair-cli-${{ steps.normalize_version.outputs.version_no_v }}.tgz.sha256
release/pair-cli-${{ steps.normalize_version.outputs.version_no_v }}.meta.json
retention-days: 30
- name: Smoke-test manual ZIP artifact (verify checksum, run --version, run pair install)
env:
PAIR_DIAG: '1'
run: |
chmod +x scripts/workflows/release/smoke-test-manual-artifact.sh
./scripts/workflows/release/smoke-test-manual-artifact.sh ${{ steps.normalize_version.outputs.version_no_v }}
- name: Smoke-test npm TGZ artifact (verify checksum, install into sample-project, run --version, run pair install)
env:
PAIR_DIAG: '1'
run: |
chmod +x scripts/workflows/release/smoke-test-npm-artifact.sh
./scripts/workflows/release/smoke-test-npm-artifact.sh ${{ steps.normalize_version.outputs.version_no_v }}
- name: Create GitHub Release and upload assets
if: github.event_name != 'workflow_dispatch' || github.event.inputs.version != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
chmod +x scripts/workflows/release/create-github-release.sh
./scripts/workflows/release/create-github-release.sh ${{ steps.version.outputs.version }} ${{ github.token }}
deploy-website:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: '10.15.0'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Vercel CLI rejects deploys when the commit author email is not in the
# Vercel account's verified emails. Amend locally (never pushed) to set
# the org email so the deploy succeeds.
- name: Set git author for Vercel
run: |
git config user.email "foomakers42@gmail.com"
git config user.name "foomakers"
git commit --amend --no-edit --reset-author --no-verify
- name: Deploy to Vercel (production)
run: |
chmod +x scripts/workflows/release/deploy-website.sh
./scripts/workflows/release/deploy-website.sh --prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
publish-npm:
runs-on: ubuntu-latest
needs: release
permissions:
contents: read
# Run this job for manual dispatch with publish=true OR when a tag push starting with v* occurs
if: >
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
|| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Download TGZ artifact
uses: actions/download-artifact@v4
with:
name: pair-cli-tgz-${{ needs.release.outputs.version_no_v || needs.release.outputs.version }}
- name: Publish to npmjs.org
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
V=${{ needs.release.outputs.version_no_v || needs.release.outputs.version }}
TGZ=pair-cli-${V}.tgz
chmod +x scripts/publish-npm.sh
./scripts/publish-npm.sh "$TGZ"