mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-06 19:35:13 +02:00
* fix: Enhance release packaging for cross-platform compatibility * fix: Resolve pipeline bug with zip command on Windows * fix: Clarify changelog entry for Windows zip command issue in release pipeline * Update CHANGELOG.MD Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
name: Release build & publish
|
||
|
||
on:
|
||
release:
|
||
types: [created]
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
env:
|
||
BIN_NAME: nyx
|
||
|
||
jobs:
|
||
build-and-upload:
|
||
strategy:
|
||
matrix:
|
||
include:
|
||
- target: x86_64-unknown-linux-gnu
|
||
os: ubuntu-latest
|
||
- target: x86_64-pc-windows-msvc
|
||
os: windows-latest
|
||
- target: x86_64-apple-darwin
|
||
os: macos-14
|
||
- target: aarch64-apple-darwin
|
||
os: macos-14
|
||
runs-on: ${{ matrix.os }}
|
||
|
||
steps:
|
||
- name: Check out sources
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Install Rust toolchain
|
||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||
with:
|
||
toolchain: stable
|
||
target: ${{ matrix.target }}
|
||
cache: true
|
||
|
||
- name: Install target
|
||
run: rustup target add ${{ matrix.target }}
|
||
|
||
- name: Build
|
||
run: cargo build --release --bin ${{ env.BIN_NAME }} --target ${{ matrix.target }}
|
||
|
||
- name: Install cargo-about
|
||
run: cargo install cargo-about --locked
|
||
|
||
- name: Generate license bundle
|
||
run: cargo about generate about.hbs -o THIRDPARTY-LICENSES.html
|
||
|
||
- name: Package (Linux & macOS)
|
||
if: runner.os != 'Windows'
|
||
shell: bash
|
||
run: |
|
||
set -euo pipefail
|
||
BIN=${{ env.BIN_NAME }}
|
||
TARGET=${{ matrix.target }}
|
||
EXT=$([[ "$TARGET" == *windows* ]] && echo ".exe" || echo "")
|
||
BIN_PATH=target/$TARGET/release/$BIN$EXT
|
||
mkdir -p dist
|
||
ARCHIVE=$BIN-$TARGET.zip
|
||
zip -9 "dist/$ARCHIVE" "$BIN_PATH" THIRDPARTY-LICENSES.html LICENSE* COPYING*
|
||
echo "ASSET=$ARCHIVE" >> "$GITHUB_ENV"
|
||
|
||
- name: Package (Windows)
|
||
if: runner.os == 'Windows'
|
||
shell: pwsh
|
||
run: |
|
||
$Bin = '${{ env.BIN_NAME }}'
|
||
$Target = '${{ matrix.target }}'
|
||
$Ext = '.exe'
|
||
$BinPath = "target/$Target/release/$Bin$Ext"
|
||
New-Item -ItemType Directory -Path dist -Force | Out-Null
|
||
$Archive = "$Bin-$Target.zip"
|
||
|
||
# PowerShell’s native ZIP
|
||
Compress-Archive `
|
||
-Path $BinPath, 'THIRDPARTY-LICENSES.html', 'LICENSE*', 'COPYING*' `
|
||
-DestinationPath "dist/$Archive" `
|
||
-CompressionLevel Optimal
|
||
|
||
Add-Content -Path $env:GITHUB_ENV -Value "ASSET=$Archive"
|
||
|
||
- name: Upload to the release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
files: dist/${{ env.ASSET }}
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|