diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 309cf27..8de4d44 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -6,16 +6,11 @@ on: tags: ["v*"] jobs: - build: - name: Build ${{ matrix.target }} + build-and-release: runs-on: ubuntu-latest - strategy: - matrix: - include: - - target: x86_64-unknown-linux-gnu - use-cross: false - - target: aarch64-unknown-linux-gnu - use-cross: true + # Added permissions explicitly to prevent the "Blocked" error + permissions: + contents: write steps: - name: Checkout repository @@ -24,56 +19,40 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: ${{ matrix.target }} + targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu - name: Install cross - if: matrix.use-cross == true uses: taiki-e/install-action@v2 with: tool: cross - - name: Build binary + - name: Build x86_64 (Native) + run: cargo build --release --target x86_64-unknown-linux-gnu + + - name: Build ARM64 (Cross) env: CROSS_CONTAINER_IN_CONTAINER: true + run: cross build --release --target aarch64-unknown-linux-gnu + + - name: Prepare Binaries run: | - if [ "${{ matrix.use-cross }}" == "true" ]; then - cross build --release --target ${{ matrix.target }} - else - cargo build --release --target ${{ matrix.target }} - fi + mkdir -p release-artifacts + cp target/x86_64-unknown-linux-gnu/release/escape_room_server release-artifacts/escape_room_server-x86_64 + cp target/aarch64-unknown-linux-gnu/release/escape_room_server release-artifacts/escape_room_server-aarch64 - # Prepare binary for upload - mkdir -p staging - cp target/${{ matrix.target }}/release/escape_room_server staging/escape_room_server-${{ matrix.target }} - - - name: Upload artifacts (Internal) + - name: Upload Artifacts (Internal) uses: actions/upload-artifact@v4 with: - name: binary-${{ matrix.target }} - path: staging/escape_room_server-${{ matrix.target }} - - release: - name: Gitea Release - needs: build - # CRITICAL: This ensures the release job ONLY runs when you push a tag - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: release-bins - pattern: binary-* - merge-multiple: true + name: escape-room-binaries + path: release-artifacts/* - name: Create Gitea Release - # Using a Gitea-compatible release action - uses: https://github.com/softprops/action-gh-release@v2 + # This only runs if the push was a tag + if: startsWith(github.ref, 'refs/tags/') + uses: https://gitea.com/actions/release-action@v1 with: - # Gitea uses the same 'GITHUB_TOKEN' secret name by default - token: ${{ secrets.GITHUB_TOKEN }} - files: release-bins/* - draft: false - prerelease: false - generate_release_notes: true + files: | + release-artifacts/escape_room_server-x86_64 + release-artifacts/escape_room_server-aarch64 + api_key: ${{ secrets.GITHUB_TOKEN }} + base_url: ${{ github.server_url }}