nyx/.github/workflows/release-build.yml
Eli Peter d50684e31b
docs: Add section on advantages of using Nyx in README (#10)
* docs: Add section on advantages of using Nyx in README

* ci: Update branch references from 'main' to 'master' in CI configuration

* docs: Add third-party licenses documentation and update build process

* Update .github/workflows/release-build.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* docs: Add third-party licenses documentation and update build process

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 01:42:10 +02:00

74 lines
2 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 --format html > THIRDPARTY-LICENSES.html
- name: Package
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
if [[ ! -f "$BIN_PATH" ]]; then
echo "::error ::Binary $BIN_PATH not found"
ls -R target/$TARGET/release || true
exit 1
fi
mkdir -p dist
ARCHIVE=$BIN-$TARGET.zip
zip -9 "dist/$ARCHIVE" "$BIN_PATH" THIRDPARTY-LICENSES.html LICENSE* COPYING* || true
echo "ASSET=$ARCHIVE" >> "$GITHUB_ENV"
- name: Upload to the release
uses: softprops/action-gh-release@v2
with:
files: dist/${{ env.ASSET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}