diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09e3ff2..09a6e2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,30 +8,40 @@ on: 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 + echo 'deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse' | tee /etc/apt/sources.list + apt-get update -qq + + - name: Install Rust + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + . "$HOME/.cargo/env" + + # 安装交叉编译目标 + rustup target add aarch64-unknown-linux-gnu || true + rustup target add x86_64-apple-darwin || true + rustup target add aarch64-apple-darwin || true + rustup target add x86_64-pc-windows-gnu || true - 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 + cat > ~/.cargo/config.toml << 'CARGO_EOF' +[source.crates-io] +replace-with = "ustc" + +[source.ustc] +registry = "sparse+https://mirrors.ustc.edu.cn/crates.io/index/" +CARGO_EOF - name: Checkout code run: git clone https://hub.gaomia.site/titor/haibao-tts-cli.git /workspace/mimo-tts - - name: Build binaries + - name: Build all binaries run: | + . "$HOME/.cargo/env" cd /workspace/mimo-tts # Linux x86_64 @@ -39,8 +49,20 @@ jobs: mv target/release/mimo-tts mimo-tts-linux-amd64 # Linux ARM64 - GOOS=linux GOARCH=arm64 cargo build --release -p mimo-tts + GOOS=linux GOARCH=arm64 cargo build --release -p mimo-tts --target aarch64-unknown-linux-gnu mv target/release/mimo-tts mimo-tts-linux-arm64 + + # macOS x86_64 + GOOS=darwin GOARCH=amd64 cargo build --release -p mimo-tts --target x86_64-apple-darwin + mv target/release/mimo-tts mimo-tts-darwin-amd64 + + # macOS ARM64 + GOOS=darwin GOARCH=arm64 cargo build --release -p mimo-tts --target aarch64-apple-darwin + mv target/release/mimo-tts mimo-tts-darwin-arm64 + + # Windows x86_64 + GOOS=windows GOARCH=amd64 cargo build --release -p mimo-tts --target x86_64-pc-windows-gnu + mv target/release/mimo-tts.exe mimo-tts-windows-amd64.exe - name: Generate checksums run: |