Skip to content

Release

Release #13

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to publish, without leading v"
required: true
ref:
description: "Git ref to publish from, such as v1.1.0"
required: false
concurrency:
group: release-${{ github.ref }}-${{ github.event.inputs.version || '' }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- uses: actions/setup-node@v6
with:
node-version: "24"
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Install dependencies
run: bun install --frozen-lockfile
- name: TypeScript typecheck
run: bun run typecheck
- name: Build
run: bun run build
- name: Test
run: bun run test
- name: Install OpenCode CLI for e2e
run: npm install -g opencode-ai@1.15.5
- name: E2E tests
run: bun run test:e2e
- name: Format check
run: bun run format:check
- name: Lint
run: bun run lint
publish-npm:
name: Publish ${{ matrix.package }} to npm
runs-on: ubuntu-latest
needs: [test]
strategy:
fail-fast: false
matrix:
include:
- package: "@cortexkit/anthropic-auth-core"
workspace: "@cortexkit/anthropic-auth-core"
- package: "@cortexkit/opencode-anthropic-auth"
workspace: "@cortexkit/opencode-anthropic-auth"
- package: "@cortexkit/pi-anthropic-auth"
workspace: "@cortexkit/pi-anthropic-auth"
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Ensure latest npm (for trusted publishing)
run: npm install -g npm@latest
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Resolve release version
id: version
run: |
VERSION="${{ github.event.inputs.version || github.ref_name }}"
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Sync version
run: node scripts/version-sync.mjs "${{ steps.version.outputs.version }}"
- name: Build
run: bun run build
- name: Check whether package version is already published
id: published
run: |
if npm view "${{ matrix.package }}@${{ steps.version.outputs.version }}" version >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "${{ matrix.package }}@${{ steps.version.outputs.version }} is already published; skipping."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
# Uses npm Trusted Publishing (OIDC) configured on npmjs.com.
# Each package runs in a separate matrix job so npm obtains a package-scoped
# OIDC publish token for that package instead of reusing the previous one.
- name: Publish package to npm
if: steps.published.outputs.exists != 'true'
run: npm publish --workspace "${{ matrix.workspace }}" --access public --provenance
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [test]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v6
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true