# Gitea Actions: cross-compiles the Windows client on a Linux runner with MinGW, # since most Gitea runners are Linux containers. name: Windows client on: push: branches: [main] tags: ["v*"] pull_request: workflow_dispatch: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 TARGET: x86_64-pc-windows-gnu jobs: build: name: Build Windows client runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install MinGW run: | SUDO=$(command -v sudo || true) $SUDO apt-get update $SUDO apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64 zip - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ env.TARGET }} - name: Cache cargo uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: windows-gnu-${{ hashFiles('Cargo.lock') }} restore-keys: windows-gnu- - name: Build run: cargo build --release --locked -p game_client --bin game --target "$TARGET" - name: Package run: | dist=dist/station-windows mkdir -p "$dist" cp "target/$TARGET/release/game.exe" "$dist/" cp -r assets README.md "$dist/" (cd dist && zip -qr station-windows.zip station-windows) # Gitea does not support upload-artifact v4. - name: Upload artifact uses: actions/upload-artifact@v3 with: name: station-windows path: dist/station-windows if-no-files-found: error - name: Publish release if: startsWith(github.ref, 'refs/tags/v') uses: https://gitea.com/actions/release-action@main with: files: dist/station-windows.zip api_key: ${{ secrets.GITHUB_TOKEN }}