Files
haibao-tts-cli/.github/workflows/release.yml
titor 849473aff4
Some checks failed
Release / build (push) Has been cancelled
ci: 使用 Docker container 和国内镜像源
- 使用 rust:1.82 容器
- 使用阿里云 apk 镜像源
- 使用阿里云 cargo 镜像源
- 只构建 linux 版本
2026-04-24 03:43:25 +08:00

78 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu24.04
container:
image: rust:1.82
steps:
- name: Setup mirrors
run: |
# 使用阿里云 apk 镜像源
echo -e 'https://mirrors.aliyun.com/alpine/v3.20/main/\nhttps://mirrors.aliyun.com/alpine/v3.20/community/' > /etc/apk/repositories
apk add git
- name: Setup cargo mirror
run: |
# 使用阿里云 cargo 镜像源
mkdir -p ~/.cargo
echo '[source.crates-io]
replace-with = "ustc"
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io/index/"' > ~/.cargo/config.toml
- name: Checkout code
run: git clone https://hub.gaomia.site/titor/haibao-tts-cli.git /workspace/mimo-tts
- name: Build binaries
run: |
cd /workspace/mimo-tts
# Linux x86_64
cargo build --release -p mimo-tts
mv target/release/mimo-tts mimo-tts-linux-amd64
# Linux ARM64
GOOS=linux GOARCH=arm64 cargo build --release -p mimo-tts
mv target/release/mimo-tts mimo-tts-linux-arm64
- name: Generate checksums
run: |
cd /workspace/mimo-tts
sha256sum mimo-tts-* > checksums.txt
- name: Create release
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
GITEA_URL="https://hub.gaomia.site"
REPO="titor/haibao-tts-cli"
cd /workspace/mimo-tts
COMMIT_MSG=$(git log -1 --format="%s" HEAD)
TAG_NAME="latest"
# 删除已存在的 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" \
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"Release ${TAG_NAME}\",\"body\":\"${COMMIT_MSG}\",\"draft\":false}")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
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"
done