mirror of
https://github.com/theoleuthardt/DinoGame.git
synced 2026-06-13 01:17:56 +00:00
125 lines
No EOL
3.4 KiB
YAML
125 lines
No EOL
3.4 KiB
YAML
name: Build and Release DinoGame
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
question:
|
|
description: 'Release?'
|
|
required: false
|
|
default: 'YES'
|
|
type: choice
|
|
options:
|
|
- 'YES'
|
|
- 'PLS DONT'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt install -y cmake g++
|
|
|
|
- name: Install Dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: brew install cmake gcc
|
|
|
|
- name: Install Dependencies (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
|
|
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
|
|
shell: powershell
|
|
|
|
- name: Configure CMake
|
|
run: cmake -B build
|
|
shell: bash
|
|
|
|
# Modifikation hier - manuelles Kopieren der Assets vor dem Build
|
|
- name: Copy Assets (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
mkdir -p build/macos
|
|
cp -r assets build/macos/
|
|
shell: bash
|
|
|
|
- name: Copy Assets (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
mkdir -p build/linux
|
|
cp -r assets build/linux/
|
|
shell: bash
|
|
|
|
- name: Copy Assets (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
mkdir -p build/windows
|
|
cp -r assets build/windows/
|
|
shell: bash
|
|
|
|
- name: Build Project
|
|
run: |
|
|
if [ "${{ runner.os }}" == "macOS" ]; then
|
|
cmake --build build --config Release --target DinoGame
|
|
else
|
|
cmake --build build --config Release
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Determine Output Directory
|
|
id: get-output-dir
|
|
run: |
|
|
if [ "${{ runner.os }}" == "Windows" ]; then
|
|
echo "output_dir=build/windows" >> $GITHUB_OUTPUT
|
|
elif [ "${{ runner.os }}" == "macOS" ]; then
|
|
echo "output_dir=build/macos" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "output_dir=build/linux" >> $GITHUB_OUTPUT
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Zip Build with Assets (Linux/macOS)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
cd ${{ steps.get-output-dir.outputs.output_dir }}
|
|
zip -r ../../DinoGame-${{ runner.os }}.zip .
|
|
shell: bash
|
|
|
|
- name: Zip Build with Assets (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
cd ${{ steps.get-output-dir.outputs.output_dir }}
|
|
powershell Compress-Archive -Path .\* -DestinationPath ..\..\DinoGame-${{ runner.os }}.zip
|
|
shell: bash
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: DinoGame-${{ runner.os }}
|
|
path: DinoGame-${{ runner.os }}.zip
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: github.event.inputs.question == 'YES'
|
|
steps:
|
|
- name: Download All Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*
|
|
tag_name: ${{ github.ref_name }}
|
|
name: Release ${{ github.ref_name }}
|
|
draft: false
|
|
prerelease: false |