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

62 lines
1.5 KiB
YAML

name: Windows client
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
build:
name: Build Windows client
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --locked -p game_client --bin game
- name: Package
shell: pwsh
run: |
$dist = "dist/station-windows"
New-Item -ItemType Directory -Force -Path $dist | Out-Null
Copy-Item target/release/game.exe $dist/
Copy-Item -Recurse assets $dist/assets
Copy-Item README.md $dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: station-windows
path: dist/station-windows
if-no-files-found: error
- name: Create release archive
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
run: Compress-Archive -Path dist/station-windows/* -DestinationPath dist/station-windows.zip
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: dist/station-windows.zip