85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: linux-amd64
|
|
- os: ubuntu-latest
|
|
target: linux-arm64
|
|
- os: macos-latest
|
|
target: darwin-amd64
|
|
- os: macos-latest
|
|
target: darwin-arm64
|
|
- os: windows-latest
|
|
target: windows-amd64
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-action@stable
|
|
|
|
- name: Build binary
|
|
run: |
|
|
ext=""
|
|
[ "${{ matrix.target }}" = "windows-amd64" ] && ext=".exe"
|
|
|
|
if [ "${{ matrix.target }}" = "linux-arm64" ]; then
|
|
GOOS=linux GOARCH=arm64 cargo build --release -p mimo-tts --target aarch64-unknown-linux-gnu
|
|
elif [ "${{ matrix.target }}" = "darwin-amd64" ]; then
|
|
GOOS=darwin GOARCH=amd64 cargo build --release -p mimo-tts
|
|
elif [ "${{ matrix.target }}" = "darwin-arm64" ]; then
|
|
GOOS=darwin GOARCH=arm64 cargo build --release -p mimo-tts
|
|
elif [ "${{ matrix.target }}" = "windows-amd64" ]; then
|
|
GOOS=windows GOARCH=amd64 cargo build --release -p mimo-tts
|
|
else
|
|
cargo build --release -p mimo-tts
|
|
fi
|
|
|
|
mv target/release/mimo-tts "mimo-tts-${{ matrix.target }}${ext}"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mimo-tts-${{ matrix.target }}
|
|
path: mimo-tts-${{ matrix.target }}*
|
|
retention-days: 1
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
cd artifacts
|
|
sha256sum mimo-tts-* > checksums.txt
|
|
|
|
- name: Create release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.release }}
|
|
run: |
|
|
cd artifacts
|
|
COMMIT_MSG=$(git log -1 --format="%s" HEAD)
|
|
|
|
# 使用 GitHub CLI 创建 release
|
|
gh release create latest \
|
|
--title "Latest Release" \
|
|
--notes "$COMMIT_MSG" \
|
|
mimo-tts-* checksums.txt |