Build #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
inputs: | |
nightly: | |
description: 'Build nightly version' | |
required: false | |
default: 'true' | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [macos-latest, macos-13] | |
include: | |
- os: macos-latest | |
os-name: macos | |
arch: arm64 | |
- os: macos-13 | |
os-name: macos | |
arch: x86 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# - name: Install LLVM and Clang | |
# uses: KyleMayes/install-llvm-action@v2 | |
# with: | |
# version: "19.1" | |
- name: Install dependencies on macOS | |
run: | | |
brew install llvm | |
brew install boost | |
brew install ninja | |
- name: Configure CMake | |
run: > | |
cmake -B build/release | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-GNinja | |
-DCMAKE_C_COMPILER="$(brew --prefix llvm)/bin/clang" | |
-DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" | |
-DSDL_SHARED=OFF | |
-DSDL_STATIC=ON | |
-DBLEND2D_STATIC=ON | |
- name: Build neogurt | |
run: cmake --build build/release --target neogurt | |
- name: Generate package | |
run: make package | |
- name: Rename DMG for nightly | |
if: ${{ github.event.inputs.nightly == 'true' }} | |
run: | | |
cd build/release | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
mv Neogurt*.dmg Neogurt-${COMMIT_HASH}.dmg | |
- name: Prepare artifacts | |
run: | | |
cd build/release | |
echo "ARTIFACT_NAME=$(ls Neogurt*.dmg)" >> $GITHUB_ENV | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: build/release/${{ env.ARTIFACT_NAME }} | |
# - name: Create release for nightly | |
# if: ${{ github.event.inputs.nightly == 'true' }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: | | |
# TAG_NAME="nightly-$(date +%Y-%m-%d)" | |
# RELEASE_NAME="Nightly Build $(date +%Y-%m-%d)" | |
# FILE_PATH="build/release/${{ env.ARTIFACT_NAME }}" | |
# gh release create $TAG_NAME $FILE_PATH \ | |
# --title "$RELEASE_NAME" \ | |
# --notes "Nightly build for commit ${{ github.sha }}" \ | |
# --prerelease | |
create-release: | |
if: ${{ github.event.inputs.nightly == 'true' }} | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: Create Release with gh CLI | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TAG_NAME="nightly-$(date +'%Y-%m-%d')" | |
RELEASE_NAME="Nightly Build $(date +'%Y-%m-%d')" | |
gh release create $TAG_NAME artifacts/* \ | |
--title "$RELEASE_NAME" \ | |
--notes "Nightly build for commit ${{ github.sha }}" \ | |
--prerelease |