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.
|
# since most Gitea runners are Linux containers.
|
||||||
name: Windows client
|
name: Windows package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -16,7 +16,7 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Windows client
|
name: Build Windows package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
SUDO=$(command -v sudo || true)
|
SUDO=$(command -v sudo || true)
|
||||||
$SUDO apt-get update
|
$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
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
@ -42,28 +42,20 @@ jobs:
|
||||||
key: windows-gnu-${{ hashFiles('Cargo.lock') }}
|
key: windows-gnu-${{ hashFiles('Cargo.lock') }}
|
||||||
restore-keys: windows-gnu-
|
restore-keys: windows-gnu-
|
||||||
|
|
||||||
- name: Build
|
- name: Pack client and server
|
||||||
run: cargo build --release --locked -p game_client --bin game --target "$TARGET"
|
run: cargo xtask pack --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.
|
# Gitea does not support upload-artifact v4.
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: station-windows
|
name: station-windows
|
||||||
path: dist/station-windows
|
path: dist/station-*/
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Publish release
|
- name: Publish release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
with:
|
with:
|
||||||
files: dist/station-windows.zip
|
files: dist/station-*.zip
|
||||||
api_key: ${{ secrets.GITHUB_TOKEN }}
|
api_key: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: Windows client
|
name: Windows package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -17,7 +17,7 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Windows client
|
name: Build Windows package
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
@ -30,32 +30,18 @@ jobs:
|
||||||
- name: Cache cargo
|
- name: Cache cargo
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Build
|
- name: Pack client and server
|
||||||
run: cargo build --release --locked -p game_client --bin game
|
run: cargo xtask pack --target x86_64-pc-windows-msvc
|
||||||
|
|
||||||
- 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
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: station-windows
|
name: station-windows
|
||||||
path: dist/station-windows
|
path: dist/station-*/
|
||||||
if-no-files-found: error
|
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
|
- name: Publish release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: dist/station-windows.zip
|
files: dist/station-*.zip
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue