Files
vibetorrent/.gitea/workflows/build-mips.yml
spinline 03a07a9075
Some checks failed
Build MIPS Binary / build (push) Failing after 31s
ci: use Docker directly instead of cross to avoid host toolchain resolution
2026-02-06 18:04:41 +03:00

94 lines
2.8 KiB
YAML

name: Build MIPS Binary
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup toolchain install nightly --profile minimal
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup component add rust-src --toolchain nightly
rustc +nightly --version
- name: Install Trunk
run: |
if ! command -v trunk &> /dev/null; then
cargo install trunk --locked
fi
- name: Build Frontend
run: |
cd frontend
npm install
trunk build --release
- name: Install Cross
run: |
if ! command -v cross &> /dev/null; then
cargo install cross --locked
fi
- name: Build Backend (MIPS)
run: |
docker run --rm \
-v "$PWD":/project \
-v "$HOME/.cargo/registry":/root/.cargo/registry \
-w /project \
ghcr.io/cross-rs/mips-unknown-linux-musl:main \
sh -c 'rustup default nightly && rustup component add rust-src && cd backend && cargo build --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort'
- name: Rename Binary
run: mv target/mips-unknown-linux-musl/release/backend target/mips-unknown-linux-musl/release/vibetorrent-mips
- name: Generate Release Tag
id: tag
run: echo "release_tag=release-$(date +'%Y%m%d-%H%M')" >> "$GITHUB_OUTPUT"
- name: Create Release
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
TAG="${{ steps.tag.outputs.release_tag }}"
REPO="admin/vibetorrent"
API_URL="${{ gitea.server_url }}/api/v1"
# Create release
RELEASE_RESPONSE=$(curl -s -X POST "${API_URL}/repos/${REPO}/releases" \
-H "Authorization: token ${RELEASE_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"${TAG}\",
\"name\": \"Release ${TAG}\",
\"body\": \"Automated build from commit ${{ gitea.sha }}\",
\"draft\": false,
\"prerelease\": false
}")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq -r '.id')
echo "Release ID: $RELEASE_ID"
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
echo "Failed to create release:"
echo "$RELEASE_RESPONSE"
exit 1
fi
# Upload binary as release asset
curl -s -X POST "${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=vibetorrent-mips" \
-H "Authorization: token ${RELEASE_TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary @target/mips-unknown-linux-musl/release/vibetorrent-mips
echo "Release ${TAG} created with binary attached."