mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-06 19:35:13 +02:00
Added release-build.yml to automate releases
This commit is contained in:
parent
f4544d261e
commit
484f4b6d05
1 changed files with 51 additions and 0 deletions
51
.github/workflows/release-build.yml
vendored
Normal file
51
.github/workflows/release-build.yml
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
name: Release build & publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-apple-darwin
|
||||
- x86_64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.target == 'x86_64-pc-windows-msvc' && 'windows-latest' || (matrix.target == 'x86_64-apple-darwin' && 'macos-latest' || 'ubuntu-latest') }}
|
||||
|
||||
steps:
|
||||
- name: Check out sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
cache: true
|
||||
|
||||
- name: Build (optimized)
|
||||
run: cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Package binary
|
||||
shell: bash
|
||||
run: |
|
||||
BIN=nyx
|
||||
TARGET=${{ matrix.target }}
|
||||
EXT=$([ "$TARGET" = "x86_64-pc-windows-msvc" ] && echo ".exe")
|
||||
mkdir -p dist
|
||||
cp target/$TARGET/release/$BIN$EXT dist/
|
||||
cd dist
|
||||
ARCHIVE=${BIN}-${TARGET}.zip # zip works everywhere; tar.gz is fine too
|
||||
zip -9 $ARCHIVE $BIN$EXT
|
||||
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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue