claude-code-router/.github/workflows/release.yml

115 lines
2.9 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
macos:
name: macOS
runs-on: macos-14
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify tag version
shell: bash
run: |
tag_version="${GITHUB_REF_NAME#v}"
package_version="$(node -p "require('./package.json').version")"
if [[ "$tag_version" != "$package_version" ]]; then
echo "Tag v$tag_version does not match package.json version $package_version"
exit 1
fi
- name: Build and publish ad-hoc macOS artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build:assets
npx electron-builder --config build/electron-builder.local.cjs --mac --publish always
windows:
name: Windows
needs: macos
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify tag version
shell: bash
run: |
tag_version="${GITHUB_REF_NAME#v}"
package_version="$(node -p "require('./package.json').version")"
if [[ "$tag_version" != "$package_version" ]]; then
echo "Tag v$tag_version does not match package.json version $package_version"
exit 1
fi
- name: Build and publish Windows artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build:assets
npx electron-builder --win --publish always
linux:
name: Linux
needs: macos
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify tag version
shell: bash
run: |
tag_version="${GITHUB_REF_NAME#v}"
package_version="$(node -p "require('./package.json').version")"
if [[ "$tag_version" != "$package_version" ]]; then
echo "Tag v$tag_version does not match package.json version $package_version"
exit 1
fi
- name: Build and publish Linux artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build:assets
npx electron-builder --linux AppImage --publish always