mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-06 19:35:13 +02:00
63 lines
1.7 KiB
YAML
63 lines
1.7 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: Package
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
BIN_PATH=target/${{ matrix.target }}/release/${{ env.BIN_NAME }}$([[ "${{ matrix.target }}" == *windows* ]] && echo ".exe")
|
|
if [[ ! -f "$BIN_PATH" ]]; then
|
|
echo "::error ::expected binary not found"; ls -l target/${{ matrix.target }}/release; exit 1
|
|
fi
|
|
mkdir -p dist
|
|
ARCHIVE=${{ env.BIN_NAME }}-${{ matrix.target }}.zip
|
|
zip -9 "dist/$ARCHIVE" "$BIN_PATH"
|
|
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 }}
|