| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- name: Release
- on:
- push:
- tags:
- - 'v*'
- jobs:
- # 第一步:类型检查、更新版本号并提交
- update-version:
- runs-on: ubuntu-latest
- outputs:
- version: ${{ steps.version.outputs.VERSION }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
- - name: Install dependencies
- run: npm ci
- - name: Type check
- run: npm run typecheck
- - name: Extract version from tag
- id: version
- run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- - name: Update version in all config files
- run: |
- # Update package.json
- npm pkg set version=${{ steps.version.outputs.VERSION }}
- # Update Cargo.toml
- sed -i 's/^version = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' src-tauri/Cargo.toml
- # Update tauri.conf.json
- sed -i 's/"version": ".*"/"version": "${{ steps.version.outputs.VERSION }}"/' src-tauri/tauri.conf.json
- - name: Commit version update
- run: |
- git config user.name "github-actions[bot]"
- git config user.email "github-actions[bot]@users.noreply.github.com"
- git add package.json src-tauri/Cargo.toml src-tauri/tauri.conf.json
- git commit -m "chore: bump version to ${{ steps.version.outputs.VERSION }}" || echo "No changes to commit"
- git push origin HEAD:main
- # 第二步:并行构建所有平台
- build:
- needs: update-version
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: windows-latest
- platform: win
- target: x86_64-pc-windows-msvc
- - os: macos-latest
- platform: mac
- target: aarch64-apple-darwin
- - os: macos-latest
- platform: mac-intel
- target: x86_64-apple-darwin
- - os: ubuntu-22.04
- platform: linux
- target: x86_64-unknown-linux-gnu
- runs-on: ${{ matrix.os }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- ref: main
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@stable
- with:
- targets: ${{ matrix.target }}
- - name: Cache Cargo
- uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- src-tauri/target/
- key: cargo-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('src-tauri/Cargo.lock') }}
- restore-keys: |
- cargo-${{ runner.os }}-${{ matrix.target }}-
- - name: Install Linux dependencies
- if: matrix.platform == 'linux'
- run: |
- sudo apt-get update
- sudo apt-get install -y \
- libwebkit2gtk-4.1-dev \
- libappindicator3-dev \
- librsvg2-dev \
- patchelf \
- libgtk-3-dev \
- libayatana-appindicator3-dev
- - name: Install dependencies
- run: npm ci
- - name: Build Tauri application
- 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: ""
- with:
- tagName: v${{ needs.update-version.outputs.version }}
- releaseName: 'Claude AI Installer v${{ needs.update-version.outputs.version }}'
- releaseBody: 'See the assets to download this version and install.'
- releaseDraft: false
- prerelease: false
- args: --target ${{ matrix.target }}
|