lofivor/.github/workflows/release.yml

74 lines
1.9 KiB
YAML

name: release
on:
release:
types: [published]
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: native
artifact: lofivor-linux-x86_64
- os: ubuntu-latest
target: x86_64-windows-gnu
artifact: lofivor-windows-x86_64.exe
- os: macos-latest
target: native
artifact: lofivor-macos-aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.15.2
- name: Install X11 dependencies (Linux)
if: matrix.os == 'ubuntu-latest' && matrix.target == 'native'
run: sudo apt-get update && sudo apt-get install -y libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libgl1-mesa-dev
- name: Build native
if: matrix.target == 'native'
run: zig build -Doptimize=ReleaseFast
- name: Build cross-compile
if: matrix.target != 'native'
run: zig build -Dtarget=${{ matrix.target }} -Doptimize=ReleaseFast
- name: Rename artifact (Unix)
if: "!contains(matrix.artifact, '.exe')"
run: mv zig-out/bin/sandbox ${{ matrix.artifact }}
- name: Rename artifact (Windows)
if: contains(matrix.artifact, '.exe')
run: mv zig-out/bin/sandbox.exe ${{ matrix.artifact }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- run: chmod +x artifacts/*
- uses: softprops/action-gh-release@v2
with:
files: artifacts/*