fix: include version name in macos artifacts #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| jobs: | |
| build-tauri: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: "macos-latest" | |
| args: "--target aarch64-apple-darwin" | |
| - platform: "macos-latest" | |
| args: "--target x86_64-apple-darwin" | |
| - platform: "macos-latest" | |
| args: "--target universal-apple-darwin" | |
| - platform: "ubuntu-22.04" | |
| args: "" | |
| - platform: "ubuntu-24.04-arm" | |
| args: "" | |
| - platform: "windows-latest" | |
| args: "" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (Linux) | |
| if: startsWith(matrix.platform, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config libsoup-3.0-dev javascriptcoregtk-4.1 libjavascriptcoregtk-4.1-dev | |
| sudo apt-get install -y libnm-dev xdg-utils | |
| - name: Rust setup | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || (contains(matrix.args, 'aarch64') && 'aarch64-unknown-linux-gnu' || '') }} | |
| - name: Node.js setup | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| cache-dependency-path: apps/web-dashboard/package-lock.json | |
| - name: Install Frontend Dependencies | |
| run: | | |
| cd apps/web-dashboard | |
| npm install | |
| - name: Build Tauri App | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| with: | |
| projectPath: apps/desktop | |
| tauriScript: npx @tauri-apps/cli@2 | |
| args: ${{ matrix.args }} | |
| - name: Rename and Prepare Artifacts | |
| shell: bash | |
| run: | | |
| # 提取架构信息用于重命名 | |
| if [[ "${{ matrix.args }}" == *"--target aarch64"* ]]; then | |
| ARCH="aarch64" | |
| elif [[ "${{ matrix.args }}" == *"--target x86_64"* ]]; then | |
| ARCH="x64" | |
| elif [[ "${{ matrix.args }}" == *"--target universal"* ]]; then | |
| ARCH="universal" | |
| else | |
| ARCH="default" | |
| fi | |
| echo "Renaming artifacts with arch: $ARCH and version: ${{ github.ref_name }}" | |
| mkdir -p artifacts-out | |
| # 查找并重命名 macos 产物,增加版本和架构后缀 | |
| find target -name "*.dmg" -exec cp {} artifacts-out/Antigravity-Tools-LS_${{ github.ref_name }}_${ARCH}.dmg \; || true | |
| find target -name "*.app.tar.gz" -exec cp {} artifacts-out/Antigravity-Tools-LS_${{ github.ref_name }}_${ARCH}.app.tar.gz \; || true | |
| find target -name "*.app.tar.gz.sig" -exec cp {} artifacts-out/Antigravity-Tools-LS_${{ github.ref_name }}_${ARCH}.app.tar.gz.sig \; || true | |
| # Windows/Linux 保持原样(它们自带版本号) | |
| find target -name "*.exe" -exec cp {} artifacts-out/ \; || true | |
| find target -name "*.AppImage" -exec cp {} artifacts-out/ \; || true | |
| find target -name "*.AppImage.sig" -exec cp {} artifacts-out/ \; || true | |
| echo "Current artifacts prepared:" | |
| ls -R artifacts-out/ | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-assets-${{ matrix.platform }}-${{ strategy.job-index }} | |
| path: artifacts-out/* | |
| if-no-files-found: error | |
| publish-release: | |
| needs: build-tauri | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 下载所有构建产物 (仅限 release 相关的 assets 和 updater) | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: all-artifacts | |
| pattern: "{release-assets-*,updater-json-*}" | |
| merge-multiple: true | |
| - name: Extract Release Notes | |
| run: | | |
| VERSION="${{ github.ref_name }}" | |
| echo "Extracting release notes for version $VERSION" | |
| # Extract English Notes | |
| awk -v ver="$VERSION" ' | |
| BEGIN { capture=0 } | |
| $0 ~ "^### " ver { capture=1; next } | |
| capture && $0 ~ "^### v" { capture=0; exit } | |
| capture { print } | |
| ' README.md > release_notes_en.md | |
| # Extract Chinese Notes | |
| awk -v ver="$VERSION" ' | |
| BEGIN { capture=0 } | |
| $0 ~ "^### " ver { capture=1; next } | |
| capture && $0 ~ "^### v" { capture=0; exit } | |
| capture { print } | |
| ' README_ZH.md > release_notes_zh.md | |
| if [ -s release_notes_en.md ] || [ -s release_notes_zh.md ]; then | |
| echo "## English Changelog" > release_notes.md | |
| cat release_notes_en.md >> release_notes.md | |
| echo "" >> release_notes.md | |
| echo "## 中文更新日志" >> release_notes.md | |
| cat release_notes_zh.md >> release_notes.md | |
| else | |
| echo "See the assets to download this version and install." > release_notes.md | |
| fi | |
| - name: Build updater.json from signatures | |
| env: | |
| VERSION: ${{ github.ref_name }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| DOWNLOAD_BASE="https://github.com/${REPO}/releases/download/${VERSION}" | |
| VER="${VERSION#v}" | |
| # Helper: read signature content from .sig file in artifacts | |
| read_sig() { | |
| local pattern="$1" | |
| local sig_file | |
| sig_file=$(find all-artifacts -name "$pattern" -type f 2>/dev/null | head -1) | |
| if [ -n "$sig_file" ] && [ -f "$sig_file" ]; then | |
| cat "$sig_file" | |
| else | |
| echo "" | |
| fi | |
| } | |
| # Read signatures for each platform | |
| MACOS_AARCH64_SIG=$(read_sig "*_aarch64.app.tar.gz.sig") | |
| MACOS_X64_SIG=$(read_sig "*_x64.app.tar.gz.sig") | |
| WINDOWS_NSIS_SIG=$(read_sig "*_x64-setup.exe.sig") | |
| LINUX_AMD64_SIG=$(read_sig "*_amd64.AppImage.sig") | |
| LINUX_AARCH64_SIG=$(read_sig "*_aarch64.AppImage.sig") | |
| echo "Signatures found:" | |
| [ -n "$MACOS_AARCH64_SIG" ] && echo " macOS aarch64: YES" || echo " macOS aarch64: NO" | |
| [ -n "$MACOS_X64_SIG" ] && echo " macOS x64: YES" || echo " macOS x64: NO" | |
| [ -n "$WINDOWS_NSIS_SIG" ] && echo " Windows x64: YES" || echo " Windows x64: NO" | |
| [ -n "$LINUX_AMD64_SIG" ] && echo " Linux amd64: YES" || echo " Linux amd64: NO" | |
| [ -n "$LINUX_AARCH64_SIG" ] && echo " Linux aarch64: YES" || echo " Linux aarch64: NO" | |
| # Build updater.json with platform-specific download URLs and signatures | |
| # macOS: arch-suffixed filenames (no version in name) | |
| # Windows/Linux: version included in filename | |
| jq -n \ | |
| --arg version "$VER" \ | |
| --arg notes "See release page for details" \ | |
| --arg pub_date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ | |
| --arg dl "$DOWNLOAD_BASE" \ | |
| --arg mac_a64_sig "$MACOS_AARCH64_SIG" \ | |
| --arg mac_x64_sig "$MACOS_X64_SIG" \ | |
| --arg win_nsis_sig "$WINDOWS_NSIS_SIG" \ | |
| --arg linux_amd64_sig "$LINUX_AMD64_SIG" \ | |
| --arg linux_a64_sig "$LINUX_AARCH64_SIG" \ | |
| --arg ver "$VER" \ | |
| '{ | |
| version: $version, | |
| notes: $notes, | |
| pub_date: $pub_date, | |
| platforms: { | |
| "darwin-aarch64": { | |
| url: "\($dl)/Antigravity.Tools_aarch64.app.tar.gz", | |
| signature: $mac_a64_sig | |
| }, | |
| "darwin-x86_64": { | |
| url: "\($dl)/Antigravity.Tools_x64.app.tar.gz", | |
| signature: $mac_x64_sig | |
| }, | |
| "windows-x86_64": { | |
| url: "\($dl)/Antigravity.Tools_\($ver)_x64-setup.exe", | |
| signature: $win_nsis_sig | |
| }, | |
| "linux-x86_64": { | |
| url: "\($dl)/Antigravity.Tools_\($ver)_amd64.AppImage", | |
| signature: $linux_amd64_sig | |
| }, | |
| "linux-aarch64": { | |
| url: "\($dl)/Antigravity.Tools_\($ver)_aarch64.AppImage", | |
| signature: $linux_a64_sig | |
| } | |
| } | |
| }' > updater.json | |
| echo "Generated updater.json:" | |
| cat updater.json | |
| # 使用 ncipollo/release-action 进行统一发布,支持稳健覆盖 | |
| - name: Create or Update GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| allowUpdates: true | |
| name: "Antigravity Tools ${{ github.ref_name }}" | |
| bodyFile: "release_notes.md" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| artifacts: "all-artifacts/**/*,updater.json" | |
| artifactErrorsFailBuild: false | |
| replacesArtifacts: true | |
| makeLatest: legacy | |