ci(release): finalize v0.1.9 publishing

This commit is contained in:
lzt404 committed 2026-07-19 17:16:39 +08:00
1 parent ad02c2a8a6
commit 0823f41176
6 files changed
+73 -23

No files matched your search

+68 -18
View File
@@ -1,9 +1,12 @@
name: Build portable releases
run-name: >-
Portable release ${{ github.ref_type == 'tag' && github.ref_name || inputs.release_tag || github.ref_name }}
Portable release ${{ github.event.release.tag_name || (github.ref_type == 'tag' && github.ref_name) || inputs.release_tag || github.ref_name }}
on:
release:
types:
- published
workflow_dispatch:
inputs:
release_tag:
@@ -25,10 +28,13 @@ permissions:
jobs:
validate:
name: Validate source
if: github.event_name != 'release' || github.event.release.prerelease == true
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
@@ -66,36 +72,72 @@ jobs:
include:
- runner: ubuntu-24.04
os: linux
display_os: Linux
arch: amd64
suffix: tar.gz
- runner: ubuntu-24.04-arm
os: linux
display_os: Linux
arch: aarch64
suffix: tar.gz
- runner: macos-15-intel
os: darwin
arch: amd64
suffix: tar.gz
- runner: macos-15
os: darwin
arch: aarch64
suffix: tar.gz
# - runner: macos-15-intel
# os: darwin
# display_os: Darwin
# arch: amd64
# suffix: tar.gz
# - runner: macos-15
# os: darwin
# display_os: Darwin
# arch: aarch64
# suffix: tar.gz
- runner: windows-2025
os: windows
display_os: Windows
arch: amd64
suffix: zip
- runner: windows-11-arm
os: windows
display_os: Windows
arch: aarch64
suffix: zip
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- uses: dtolnay/rust-toolchain@stable
- name: Resolve release package name
id: package
shell: bash
env:
REQUESTED_VERSION: ${{ github.event.release.tag_name || (github.ref_type == 'tag' && github.ref_name) || inputs.release_tag }}
run: |
source_version="$(node -p 'require("./package.json").version')"
version="$REQUESTED_VERSION"
if [ -z "$version" ]; then
version="v$source_version"
else
case "$version" in
v*) ;;
*) version="v$version" ;;
esac
fi
if ! node -e 'process.exit(/^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$/.test(process.argv[1]) ? 0 : 1)' "$version"; then
echo "Invalid release version: $version" >&2
exit 1
fi
if [ "${version#v}" != "$source_version" ]; then
echo "Release version $version does not match project version v$source_version" >&2
exit 1
fi
echo "stem=Easy_CLIProxyAPI-${version}-${{ matrix.display_os }}-${{ matrix.arch }}" >> "$GITHUB_OUTPUT"
- name: Install Linux dependencies
if: matrix.os == 'linux'
run: |
@@ -112,7 +154,7 @@ jobs:
run: >-
node scripts/prepare-portable.mjs
--binary "src-tauri/target/release/cpa-gui${{ matrix.os == 'windows' && '.exe' || '' }}"
--output "release/Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}"
--output "release/${{ steps.package.outputs.stem }}"
--os "${{ matrix.os }}"
--arch "${{ matrix.arch }}"
--download true
@@ -120,7 +162,7 @@ jobs:
- name: Verify archive-only core payload
shell: bash
env:
CORE_DIR: release/Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}/cpa-core
CORE_DIR: release/${{ steps.package.outputs.stem }}/cpa-core
run: |
node - <<'NODE'
const { readdirSync } = require('node:fs');
@@ -134,21 +176,24 @@ jobs:
NODE
- name: Archive Unix release
if: matrix.os != 'windows'
run: tar -czf "Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}.tar.gz" -C release "Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}"
run: tar -czf "${{ steps.package.outputs.stem }}.tar.gz" -C release "${{ steps.package.outputs.stem }}"
- name: Archive Windows release
if: matrix.os == 'windows'
shell: pwsh
run: Compress-Archive -Path "release/Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}" -DestinationPath "Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}.zip"
run: Compress-Archive -Path "release/${{ steps.package.outputs.stem }}" -DestinationPath "${{ steps.package.outputs.stem }}.zip"
- uses: actions/upload-artifact@v7
with:
name: Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}
path: Easy_CLIProxyAPI-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.suffix }}
name: ${{ steps.package.outputs.stem }}
path: ${{ steps.package.outputs.stem }}.${{ matrix.suffix }}
if-no-files-found: error
retention-days: 14
publish:
name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/') || inputs.release_tag != ''
if: >-
(github.event_name == 'release' && github.event.release.prerelease == true)
|| startsWith(github.ref, 'refs/tags/')
|| inputs.release_tag != ''
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 15
@@ -162,11 +207,16 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || inputs.release_tag }}
MANUAL_PRERELEASE: ${{ inputs.prerelease }}
RELEASE_TAG: ${{ github.event.release.tag_name || (github.ref_type == 'tag' && github.ref_name) || inputs.release_tag }}
MANUAL_PRERELEASE: ${{ github.event_name == 'release' && github.event.release.prerelease || inputs.prerelease }}
run: |
set -euo pipefail
case "$RELEASE_TAG" in
v*) ;;
*) RELEASE_TAG="v$RELEASE_TAG" ;;
esac
if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid release tag: $RELEASE_TAG" >&2
exit 1