station/.gitea/workflows/windows-client.yml

62 lines
1.6 KiB
YAML

# Gitea Actions: cross-compiles the Windows client and server on a Linux runner with MinGW,
# since most Gitea runners are Linux containers.
name: Windows package
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 package
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
- 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: Pack client and server
run: cargo xtask pack --target "$TARGET"
# Gitea does not support upload-artifact v4.
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: station-windows
path: dist/station-*/
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-*.zip
api_key: ${{ secrets.GITHUB_TOKEN }}