name: build-service on: push: branches: [main] tags: ["v*"] jobs: build-and-release: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu - name: Install cross uses: taiki-e/install-action@v2 with: tool: cross - 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: | mkdir -p release-artifacts # We use find to locate the binaries regardless of the exact target folder structure find target/x86_64-unknown-linux-gnu/release -maxdepth 1 -type f -name "escape_room_server" -exec cp {} release-artifacts/escape_room_server-x86_64 \; || cp target/release/escape_room_server release-artifacts/escape_room_server-x86_64 find target/aarch64-unknown-linux-gnu/release -maxdepth 1 -type f -name "escape_room_server" -exec cp {} release-artifacts/escape_room_server-aarch64 \; - name: Upload Artifacts (Internal) uses: actions/upload-artifact@v4 with: name: escape-room-binaries path: release-artifacts/* - name: Create Gitea Release if: startsWith(github.ref, 'refs/tags/') # Switched to @main to fix the Gitea 'reference not found' error uses: https://gitea.com/actions/release-action@main with: files: | release-artifacts/escape_room_server-x86_64 release-artifacts/escape_room_server-aarch64 api_key: ${{ secrets.GITHUB_TOKEN }} base_url: ${{ github.server_url }}