name: Release on: push: tags: - 'v*' jobs: build-linux-amd64: runs-on: linux-amd64 container: image: rust:1.88-slim steps: - uses: actions/checkout@v4 - name: Install dependencies run: | apt-get update -qq && apt-get install -y -qq \ libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev \ libayatana-appindicator3-dev librsvg2-dev patchelf \ pkg-config curl perl curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs - name: Build run: | npm ci --legacy-peer-deps rustup target add x86_64-unknown-linux-gnu cargo install tauri-cli --version "^2" --locked CI=true cargo tauri build --target x86_64-unknown-linux-gnu - name: Collect artifacts run: | mkdir -p artifacts find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \ \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \ -exec cp {} artifacts/ \; - uses: actions/upload-artifact@v4 with: name: linux-amd64 path: artifacts/ build-windows-amd64: runs-on: linux-amd64 container: image: rust:1.88-slim steps: - uses: actions/checkout@v4 - name: Install dependencies run: | apt-get update -qq && apt-get install -y -qq mingw-w64 curl nsis perl make curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs - name: Build env: CC_x86_64_pc_windows_gnu: x86_64-w64-mingw32-gcc CXX_x86_64_pc_windows_gnu: x86_64-w64-mingw32-g++ AR_x86_64_pc_windows_gnu: x86_64-w64-mingw32-ar CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc run: | npm ci --legacy-peer-deps rustup target add x86_64-pc-windows-gnu cargo install tauri-cli --version "^2" --locked CI=true cargo tauri build --target x86_64-pc-windows-gnu - name: Collect artifacts run: | mkdir -p artifacts find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \ \( -name "*.exe" -o -name "*.msi" \) \ -exec cp {} artifacts/ \; 2>/dev/null || true - uses: actions/upload-artifact@v4 with: name: windows-amd64 path: artifacts/ build-linux-arm64: runs-on: linux-arm64 container: image: rust:1.88-slim steps: - uses: actions/checkout@v4 - name: Install dependencies run: | apt-get update -qq && apt-get install -y -qq \ libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev \ libayatana-appindicator3-dev librsvg2-dev patchelf \ pkg-config curl perl curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs - name: Build run: | npm ci --legacy-peer-deps rustup target add aarch64-unknown-linux-gnu cargo install tauri-cli --version "^2" --locked CI=true cargo tauri build --target aarch64-unknown-linux-gnu - name: Collect artifacts run: | mkdir -p artifacts find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle \ \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \ -exec cp {} artifacts/ \; - uses: actions/upload-artifact@v4 with: name: linux-arm64 path: artifacts/ upload-release: needs: [build-linux-amd64, build-windows-amd64, build-linux-arm64] runs-on: linux-amd64 steps: - uses: actions/download-artifact@v4 with: path: artifacts/ - name: Create Gitea release and upload artifacts env: RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | TAG="${{ gitea.ref_name }}" REPO="${{ gitea.repository }}" API="http://gitea_app:3000/api/v1" # Create release (idempotent) curl -sf -X POST "$API/repos/$REPO/releases" \ -H "Authorization: token $RELEASE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true # Get release ID RELEASE_ID=$(curl -sf "$API/repos/$REPO/releases/tags/$TAG" \ -H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) echo "Release ID: $RELEASE_ID" # Upload all artifacts find artifacts/ -type f | while read f; do echo "Uploading $f..." curl -sf -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets" \ -H "Authorization: token $RELEASE_TOKEN" \ -F "attachment=@$f;filename=$(basename $f)" && echo "OK" || echo "Upload failed: $f" done