- 移除 matrix strategy(单 job 构建) - 移除 artifacts(直接上传) - 所有平台在一个 step 中构建
This commit is contained in:
57
.github/workflows/release.yml
vendored
57
.github/workflows/release.yml
vendored
@@ -8,54 +8,33 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu24.04
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- os: linux
|
||||
arch: amd64
|
||||
- os: linux
|
||||
arch: arm64
|
||||
- os: darwin
|
||||
arch: amd64
|
||||
- os: darwin
|
||||
arch: arm64
|
||||
- os: windows
|
||||
arch: amd64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. ~/.cargo/env
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
ext=""
|
||||
[ "${{ matrix.target.os }}" = "windows" ] && ext=".exe"
|
||||
GOOS=${{ matrix.target.os }} GOARCH=${{ matrix.target.arch }} cargo build --release -p mimo-tts
|
||||
mv target/release/mimo-tts "mimo-tts-${{ matrix.target.os }}-${{ matrix.target.arch }}${ext}"
|
||||
. ~/.cargo/env
|
||||
|
||||
for target in linux-amd64 linux-arm64 darwin-amd64 darwin-arm64 windows-amd64; do
|
||||
os=${target%-*}
|
||||
arch=${target#*-}
|
||||
ext=""
|
||||
[ "$os" = "windows" ] && ext=".exe"
|
||||
GOOS=$os GOARCH=$arch cargo build --release -p mimo-tts
|
||||
mv target/release/mimo-tts "mimo-tts-${os}-${arch}${ext}"
|
||||
done
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mimo-tts-${{ matrix.target.os }}-${{ matrix.target.arch }}
|
||||
path: mimo-tts-*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Create checksums
|
||||
- name: Checksums
|
||||
run: |
|
||||
cd artifacts
|
||||
sha256sum mimo-tts-* > checksums.txt
|
||||
|
||||
- name: Create release
|
||||
- name: Upload release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
@@ -75,7 +54,7 @@ jobs:
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
|
||||
for f in artifacts/*; do
|
||||
for f in mimo-tts-* checksums.txt; do
|
||||
[ -f "$f" ] && curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F "attachment=@$f"
|
||||
|
||||
Reference in New Issue
Block a user