From e31eb547a91ea198cef67e66a97c2b5ede607f70 Mon Sep 17 00:00:00 2001 From: titor Date: Fri, 24 Apr 2026 03:41:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 matrix strategy(单 job 构建) - 移除 artifacts(直接上传) - 所有平台在一个 step 中构建 --- .github/workflows/release.yml | 57 +++++++++++------------------------ 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0945a3c..847217e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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"