prefix #59
This file contains hidden or 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
# Builds the game for multiple platforms and uploads the artifacts | |
name: Build on multiple platforms | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build_linux: | |
name: Build for Linux for x86, x64, ARM, ARM64 and PPC64LE | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: ./build-linux.sh | |
- name: Upload Linux 386 tarball artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-386 | |
path: dist/linux_386/kens-labyrinth-linux-386.tar.gz | |
if-no-files-found: error | |
- name: Upload Linux 386 deb package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-386.deb | |
path: dist/linux_386/kens-labyrinth-linux-386.deb | |
if-no-files-found: error | |
- name: Upload Linux AMD64 tarball artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-AMD64 | |
path: dist/linux_amd64/kens-labyrinth-linux-amd64.tar.gz | |
if-no-files-found: error | |
- name: Upload Linux AMD64 deb package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-AMD64.deb | |
path: dist/linux_amd64/kens-labyrinth-linux-amd64.deb | |
if-no-files-found: error | |
- name: Upload Linux ARMv7 tarball artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-ARMv7 | |
path: dist/linux_arm_v7/kens-labyrinth-linux-armv7.tar.gz | |
if-no-files-found: error | |
- name: Upload Linux ARMv7 deb package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-ARMv7.deb | |
path: dist/linux_arm_v7/kens-labyrinth-linux-armv7.deb | |
if-no-files-found: error | |
- name: Upload Linux ARM64 tarball artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-ARM64 | |
path: dist/linux_arm64/kens-labyrinth-linux-arm64.tar.gz | |
if-no-files-found: error | |
- name: Upload Linux ARM64 deb package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-ARM64.deb | |
path: dist/linux_arm64/kens-labyrinth-linux-arm64.deb | |
if-no-files-found: error | |
- name: Upload Linux PPC64LE tarball artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-PPC64LE | |
path: dist/linux_ppc64le/kens-labyrinth-linux-ppc64le.tar.gz | |
if-no-files-found: error | |
- name: Upload Linux PPC64LE deb package artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Linux-PPC64LE.deb | |
path: dist/linux_ppc64le/kens-labyrinth-linux-ppc64le.deb | |
if-no-files-found: error | |
build_nintendo_switch: | |
name: Build for Nintendo Switch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: ./build-switch.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Nintendo-Switch | |
path: dist/switch/ken | |
if-no-files-found: error | |
build_macos: | |
name: Build for macOS for Intel and Apple Silicon | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the Apple developer certificate | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
- name: Cache Dependencies | |
id: cache-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: macports-cache | |
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/CMakeLists.txt') }} | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: | | |
brew uninstall cmake | |
mkdir -p macports-cache | |
cd macports-cache | |
git clone https://github.com/macports/macports-base.git | |
cd macports-base | |
git checkout v2.11.5 | |
./configure --enable-readline | |
make | |
sudo make install | |
make distclean | |
sudo /opt/local/bin/port -v selfupdate | |
sudo /opt/local/bin/port install cmake | |
echo "macosx_deployment_target 12.4" | sudo tee -a /opt/local/etc/macports/macports.conf > /dev/null | |
# For some reason, the following command fails if you include libsdl2 in the list with "Error: Unable to execute port libsdl2: libiconv does not have a subport 'libsdl2'" | |
# It's not a problem because libsdl2 is already a dependency of libsdl2_image so it will be installed anyway | |
sudo /opt/local/bin/port install libsdl2_image +universal libpng +universal webp +universal jpeg +universal tiff +universal zlib +universal | |
- name: Build | |
run: | | |
export PATH=/opt/local/bin:$PATH | |
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig" | |
export CMAKE_PREFIX_PATH="/opt/local" | |
mkdir -p build | |
cd build | |
cmake -G Xcode -DCMAKE_PREFIX_PATH=/opt/local -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=${{ secrets.TEAM_ID }} -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="Developer ID Application" .. | |
cmake --build . --config Release | |
brew install create-dmg | |
create-dmg ../dist/macOS/Kens-Labyrinth-macOS-Universal.dmg ../dist/macOS/ | |
- name: Notarize | |
env: | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
TEAM_ID: ${{ secrets.TEAM_ID }} | |
NOTARYTOOL_PASSWORD: ${{ secrets.NOTARYTOOL_PASSWORD }} | |
run: | | |
echo "Notarizing the app" | |
xcrun notarytool submit dist/macOS/Kens-Labyrinth-macOS-Universal.dmg --apple-id $APPLE_ID --team-id $TEAM_ID --password $NOTARYTOOL_PASSWORD --wait > notarization.log | |
echo "Notarization log:" | |
cat notarization.log | |
if grep -q "status: Accepted" notarization.log; then | |
echo "\033[32mNotarization successful" | |
echo "Stapling the ticket to the app" | |
xcrun stapler staple dist/macOS/Kens-Labyrinth-macOS-Universal.dmg | |
else | |
echo "\033[31mNotarization failed" | |
ID=$(grep "id:" notarization.log | sed 's/.*: //' | head -n 1) | |
echo "Notarization log:" | |
xcrun notarytool log ${ID} --apple-id $APPLE_ID --team-id $TEAM_ID --password $NOTARYTOOL_PASSWORD notarization_log.json | |
cat notarization_log.json | |
exit 1 | |
fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-macOS-Universal | |
path: dist/macOS/Kens-Labyrinth-macOS-Universal.dmg | |
if-no-files-found: error | |
build_windows: | |
name: Build for Windows for ARM64, x86 and x64 | |
runs-on: windows-2025 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build for ARM64 | |
run: | | |
mkdir -f build | |
cd build | |
cmake -A ARM64 .. | |
cmake --build . --config Release | |
cd .. | |
rmdir -force -recurse build | |
- name: Upload Windows ARM64 artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Windows-ARM64 | |
path: dist/windows/ | |
if-no-files-found: error | |
- name: Build for x86 | |
run: | | |
mkdir -f build | |
cd build | |
cmake -A Win32 .. | |
cmake --build . --config Release | |
cd .. | |
rmdir -force -recurse build | |
- name: Upload Windows x86 artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Windows-x86 | |
path: dist/windows/ | |
if-no-files-found: error | |
- name: Build for x64 | |
run: | | |
mkdir -f build | |
cd build | |
cmake -A x64 .. | |
cmake --build . --config Release | |
cd .. | |
rmdir -force -recurse build | |
- name: Upload Windows x64 artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Kens-Labyrinth-Windows-x64 | |
path: dist/windows/ | |
if-no-files-found: error |