Skip to content

Build Spec-Hops

Build Spec-Hops #27

Workflow file for this run

name: Release SpaceBoom
on:
release:
types: [created]
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
output_name: SpaceBoom-linux
- os: macos-latest
output_name: SpaceBoom-macos-intel
arch: x86_64
- os: macos-latest
output_name: SpaceBoom-macos-arm
arch: arm64
- os: windows-latest
output_name: SpaceBoom-windows.exe
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libwayland-dev libxkbcommon-dev xorg-dev libglu1-mesa-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install cmake ninja
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install cmake ninja
- name: Configure CMake (non-macOS)
if: matrix.os != 'macos-latest'
run: |
mkdir build
cd build
cmake -GNinja ..
- name: Configure CMake (macOS)
if: matrix.os == 'macos-latest'
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} ..
- name: Build
run: |
cd build
ninja
- name: Prepare release package
run: |
mkdir release
cp build/OpenGL/SpaceBoom${{ matrix.os == 'windows-latest' && '.exe' || '' }} release/${{ matrix.output_name }}
cp -r OpenGL/res release/res
- name: Set executable permissions (macOS)
if: matrix.os == 'macos-latest'
run: |
chmod +x release/${{ matrix.output_name }}
- name: Create release archive (Unix)
if: matrix.os != 'windows-latest'
run: |
cd release
zip -r ../${{ matrix.output_name }}.zip .
- name: Create release archive (Windows)
if: matrix.os == 'windows-latest'
run: |
Compress-Archive -Path release\* -DestinationPath ${{ matrix.output_name }}.zip
- name: Upload Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.output_name }}.zip
asset_name: ${{ matrix.output_name }}.zip
tag: ${{ github.ref }}
overwrite: true