ci: package Windows builds with cargo xtask pack
The Windows workflows now ship the dedicated server alongside the client and publish the archive produced by xtask instead of packaging by hand. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0b258a9361
commit
0c3d6c57e1
|
|
@ -1,6 +1,6 @@
|
|||
# Gitea Actions: cross-compiles the Windows client on a Linux runner with MinGW,
|
||||
# Gitea Actions: cross-compiles the Windows client and server on a Linux runner with MinGW,
|
||||
# since most Gitea runners are Linux containers.
|
||||
name: Windows client
|
||||
name: Windows package
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -16,7 +16,7 @@ env:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Windows client
|
||||
name: Build Windows package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
run: |
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64 zip
|
||||
$SUDO apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
|
@ -42,28 +42,20 @@ jobs:
|
|||
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)
|
||||
- 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-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-windows.zip
|
||||
files: dist/station-*.zip
|
||||
api_key: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name: Windows client
|
||||
name: Windows package
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -17,7 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Windows client
|
||||
name: Build Windows package
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
|
@ -30,32 +30,18 @@ jobs:
|
|||
- 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: 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-windows
|
||||
path: dist/station-*/
|
||||
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
|
||||
files: dist/station-*.zip
|
||||
|
|
|
|||
Loading…
Reference in New Issue