Update main.yml
to use up-to-date Github actions.
#458
Workflow file for this run
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: [push, pull_request, workflow_dispatch] | |
jobs: | |
windows: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: 'Sync source code' | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install Dependencies | |
uses: msys2/setup-msys2@v2 | |
with: | |
install: make mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-glew | |
- name: Build Hades | |
run: | | |
meson build -Dstatic_executable=true | |
cd build | |
ninja | |
- name: Test Hades | |
run: | | |
./build/Hades.exe --help | |
- name: Collect Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hades-win64 | |
path: build/Hades.exe | |
if-no-files-found: error | |
mac-os: | |
runs-on: macos-latest | |
steps: | |
- name: 'Sync source code' | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install Dependencies | |
run: | | |
brew install meson ninja sdl2 glew create-dmg | |
- name: Build Hades | |
run: | | |
rm -rf /tmp/build/ | |
mkdir -p /tmp/build/Hades.app | |
meson --buildtype=release --prefix=/tmp/build/Hades.app --bindir=Contents/MacOS build --werror | |
ninja -C build install | |
chmod +x /tmp/build/Hades.app/Contents/MacOS/hades /tmp/build/Hades.app/Contents/MacOS/run.sh | |
otool -L /tmp/build/Hades.app/Contents/MacOS/hades | |
cp /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib /tmp/build/Hades.app/Contents/MacOS/ | |
install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2-2.0.0.dylib /tmp/build/Hades.app/Contents/MacOS/hades | |
cp /usr/local/opt/glew/lib/libGLEW.2.2.dylib /tmp/build/Hades.app/Contents/MacOS/ | |
install_name_tool -change /usr/local/opt/glew/lib/libGLEW.2.2.dylib @executable_path/libGLEW.2.2.dylib /tmp/build/Hades.app/Contents/MacOS/hades | |
- name: Test Hades | |
run: | | |
/tmp/build/Hades.app/Contents/MacOS/hades --help | |
- name: Sign Hades App | |
# Only run if a certificate is set | |
if: ${{ env.MACOS_CODESIGN_CRT != '' && env.MACOS_CODESIGN_CRT_IDENTITY != '' }} | |
run: | | |
# Create keychain with certificate to use to sign the binaries. | |
echo "$MACOS_CODESIGN_CRT" | base64 -d > certificate.p12 | |
security create-keychain -p test123 build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p test123 build.keychain | |
security import certificate.p12 -k build.keychain -P "$MACOS_CODESIGN_CRT_PWD" -T /usr/bin/codesign | |
# Delete certificate to avoid leaking it to next steps | |
rm certificate.p12 | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k test123 build.keychain | |
echo "Signing file /tmp/build/Hades.app" | |
/usr/bin/codesign --deep --force -s "$MACOS_CODESIGN_CRT_IDENTITY" --options runtime "/tmp/build/Hades.app" -v | |
# Get rid of the keychain containing certificate to avoid leaking it | |
# to next steps. | |
security lock-keychain build.keychain | |
security default-keychain -s | |
security delete-keychain build.keychain | |
env: | |
MACOS_CODESIGN_CRT: ${{ secrets.MACOS_CODESIGN_CRT }} | |
MACOS_CODESIGN_CRT_PWD: ${{ secrets.MACOS_CODESIGN_CRT_PWD }} | |
MACOS_CODESIGN_CRT_IDENTITY: ${{ secrets.MACOS_CODESIGN_CRT_IDENTITY }} | |
- name: Pack Hades | |
run: | | |
rm -rf Hades.dmg | |
pwd | |
create-dmg \ | |
--volname "Hades Installer" \ | |
--volicon ./resource/macos/hades.icns \ | |
--background ./resource/macos/background.png \ | |
--window-pos 200 120 \ | |
--window-size 575 360 \ | |
--icon-size 100 \ | |
--icon Hades.app 150 225 \ | |
--hide-extension Hades.app \ | |
--app-drop-link 425 225 \ | |
Hades-Installer.dmg \ | |
/tmp/build/ | |
- name: Notarize Hades DMG | |
if: ${{ env.MACOS_APPLE_USERNAME != '' }} | |
run: | | |
echo "Notarizing file $file" | |
xcrun notarytool submit --apple-id "$MACOS_APPLE_USERNAME" --password "$MACOS_APPLE_PASSWORD" --team-id "$MACOS_APPLE_TEAMID" --wait "Hades-Installer.dmg" | |
xcrun stapler staple -v "Hades-Installer.dmg" | |
env: | |
MACOS_APPLE_USERNAME: ${{ secrets.MACOS_APPLE_USERNAME }} | |
MACOS_APPLE_PASSWORD: ${{ secrets.MACOS_APPLE_PASSWORD }} | |
MACOS_APPLE_TEAMID: ${{ secrets.MACOS_APPLE_TEAMID }} | |
- name: Collect Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hades-macos | |
path: Hades-Installer.dmg | |
if-no-files-found: error | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Sync source code' | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y meson ninja-build libsdl2-dev libglew-dev libgtk-3-dev | |
- name: Build Hades | |
run: | | |
meson build --werror | |
cd build | |
ninja | |
- name: Test Hades | |
run: | | |
./build/hades --help | |
- name: Collect Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hades-linux | |
path: build/hades | |
if-no-files-found: error |