ci(github): package client and server for Windows, Linux and macOS

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Steve Biedermann 2026-10-18 20:21:07 +02:00
parent 0c3d6c57e1
commit 0d025b824e
4 changed files with 89 additions and 47 deletions

82
.github/workflows/package.yml vendored Normal file
View File

@ -0,0 +1,82 @@
# Builds the client and server for every platform and packs everything needed to
# run them into an archive: a zip on Windows and a tar.gz elsewhere.
name: Package
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:
package:
name: Package ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest, target: x86_64-pc-windows-msvc }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: macos-latest, target: aarch64-apple-darwin }
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
pkg-config libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Pack client and server
run: cargo xtask pack --target ${{ matrix.target }}
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: station-${{ matrix.target }}
path: |
dist/station-*.zip
dist/station-*.tar.gz
if-no-files-found: error
# The archive is already compressed.
compression-level: 0
release:
name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
needs: package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: |
dist/station-*.zip
dist/station-*.tar.gz

View File

@ -1,47 +0,0 @@
name: Windows package
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 package
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: Pack client and server
run: cargo xtask pack --target x86_64-pc-windows-msvc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: station-windows
path: dist/station-*/
if-no-files-found: error
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: dist/station-*.zip

View File

@ -20,3 +20,5 @@ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
console window.
- `cargo xtask pack` builds the client and server and packs them with their
assets into a distributable archive; CI publishes these archives.
- GitHub `Package` workflow builds archives for Windows (zip), Linux and macOS
(tar.gz).

View File

@ -199,3 +199,8 @@ stripped `dist` profile and writes `dist/station-<version>-<target>.zip` (Window
and the changelog. Unpack it and run the binaries from that directory. The unpacked
staging directory is kept next to the archive. Options: `--format zip|tar.gz`,
`--out-dir DIR`, `--debug`.
The GitHub `Package` workflow (`.github/workflows/package.yml`) runs `pack` for Windows
(zip), Linux and macOS (tar.gz), uploads each archive as an artifact and attaches them
to the release when a `v*` tag is pushed. The Gitea workflow cross-compiles the Windows
package with MinGW.