From b0d67182129aec6372a22ff01d2d1b5995ca1183 Mon Sep 17 00:00:00 2001 From: titor Date: Fri, 24 Apr 2026 03:41:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E5=86=99=20workflow=20-=20?= =?UTF-8?q?=E9=80=82=E9=85=8D=20Gitea=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 不使用 actions/ 生态 - 直接 clone 代码构建 - 构建完成后删除旧 release 再创建新的 - 支持 windows .exe 后缀 --- .github/workflows/release.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 847217e..38d7491 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,17 +9,18 @@ jobs: build: runs-on: ubuntu24.04 steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout code + run: git clone https://hub.gaomia.site/titor/haibao-tts-cli.git /workspace/mimo-tts - - name: Setup Rust + - name: Install Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - . ~/.cargo/env + . "$HOME/.cargo/env" - - name: Build + - name: Build binaries run: | - . ~/.cargo/env + . "$HOME/.cargo/env" + cd /workspace/mimo-tts for target in linux-amd64 linux-arm64 darwin-amd64 darwin-arm64 windows-amd64; do os=${target%-*} @@ -30,23 +31,31 @@ jobs: mv target/release/mimo-tts "mimo-tts-${os}-${arch}${ext}" done - - name: Checksums + - name: Generate checksums run: | + cd /workspace/mimo-tts sha256sum mimo-tts-* > checksums.txt - - name: Upload release + - name: Create release env: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | GITEA_URL="https://hub.gaomia.site" REPO="titor/haibao-tts-cli" + WORKDIR="/workspace/mimo-tts" + cd "$WORKDIR" COMMIT_MSG=$(git log -1 --format="%s" HEAD) COMMIT_BODY=$(git log -1 --format="%b" HEAD) TAG_NAME="latest" RELEASE_BODY="${COMMIT_MSG}\n\n${COMMIT_BODY}" + # 删除已存在的 release(如果存在) + curl -s -X DELETE "${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG_NAME}" \ + -H "Authorization: token ${GITEA_TOKEN}" + + # 创建新 release RELEASE_RESPONSE=$(curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \