Files
vibetorrent/.gitea/workflows/build-mips.yml
spinline fefe86da31
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
refactor: simplify workflow to use new custom runner with pre-installed tools
2026-02-06 22:34:40 +03:00

76 lines
2.5 KiB
YAML

name: Build MIPS Binary
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: mips-builder
steps:
- name: Checkout
env:
GIT_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
rm -rf .git
git init .
git remote add origin https://admin:$\{GIT_TOKEN\}@git.karatatar.com/admin/vibetorrent.git
git fetch --depth=1 origin ${{ gitea.sha }}
git checkout FETCH_HEAD
- name: Build Frontend
run: |
cd frontend
npm install
# Run Tailwind manually first
npx @tailwindcss/cli -i input.css -o public/tailwind.css
trunk build --release
- name: Build Backend (MIPS)
run: |
cd backend
cargo zigbuild --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort
file target/mips-unknown-linux-musl/release/backend
- 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."