Add GitHub Actions workflow files for Flatpak and Windows (#142)

Co-authored-by: SuperSonic16 <25761885+thesupersonic16@users.noreply.github.com>
Co-authored-by: Dario <dariosamo@gmail.com>
This commit is contained in:
João Moura 2025-01-22 11:29:02 +00:00 committed by GitHub
parent fefd177b3a
commit e6251bdbc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 172 additions and 6 deletions

73
.github/workflows/build-flatpak.yml vendored Normal file
View file

@ -0,0 +1,73 @@
name: Build Project (Flatpak)
on:
workflow_dispatch:
env:
FLATPAK_ID: io.github.hedge_dev.unleashedrecomp
FREEDESKTOP_VERSION: 23.08
LLVM_VERSION: 18
jobs:
build-flatpak:
name: Build Flatpak
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ORG_TOKEN }}
- name: Checkout private repository
uses: actions/checkout@v4
with:
repository: ${{ secrets.ASSET_REPO }}
token: ${{ secrets.ASSET_REPO_TOKEN }}
path: flatpak/private
- name: Install dependencies
run: |-
sudo apt update
sudo apt install -y flatpak-builder ccache
- name: Cache ccache directory
uses: actions/cache@v4
with:
path: /tmp/ccache
key: ccache-${{ runner.os }}
- name: Prepare Flatpak
run: |
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install -y flathub org.freedesktop.Sdk//${{ env.FREEDESKTOP_VERSION }}
flatpak --user install -y flathub org.freedesktop.Sdk.Extension.llvm${{ env.LLVM_VERSION }}//${{ env.FREEDESKTOP_VERSION }}
- name: Build Flatpak
run: |
echo "commit_message=$(git log -1 --pretty=%s)" >> $GITHUB_ENV
export CCACHE_DIR=/tmp/ccache
flatpak-builder --user --force-clean --install-deps-from=flathub --repo=repo --install --ccache builddir ./flatpak/${{ env.FLATPAK_ID }}.json
flatpak build-bundle repo ./${{ env.FLATPAK_ID }}.flatpak ${{ env.FLATPAK_ID }} --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
# Uploads the built flatpak bundle to GitHub
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: UnleashedRecomp-flatpak
# path: ./${{ env.FLATPAK_ID }}.flatpak
- name: Upload artifact to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
if: ${{ env.DISCORD_WEBHOOK != '' }}
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ env.DISCORD_WEBHOOK }}
content: |
OS: Linux
Summary: ${{ env.commit_message }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
filename: ./${{ env.FLATPAK_ID }}.flatpak

94
.github/workflows/build-windows.yml vendored Normal file
View file

@ -0,0 +1,94 @@
name: Build Project (Windows)
on:
workflow_dispatch:
env:
CMAKE_PRESET: x64-Clang-Release
jobs:
build:
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ORG_TOKEN }}
- name: Checkout private repository
uses: actions/checkout@v4
with:
repository: ${{ secrets.ASSET_REPO }}
token: ${{ secrets.ASSET_REPO_TOKEN }}
path: .\private
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-${{ runner.os }}
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: |
./thirdparty/vcpkg/downloads
./thirdparty/vcpkg/packages
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ runner.os }}-
- name: Install dependencies
run: |
choco install ninja
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue
- name: Configure Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
- name: Prepare Project
run: |
$commitMessage = git log -1 --pretty=%s
Add-Content -Path $env:GITHUB_ENV -Value "commit_message=$commitMessage"
copy .\private\* .\UnleashedRecompLib\private
- name: Configure Project
run: cmake . --preset ${{ env.CMAKE_PRESET }} -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
- name: Build Project
run: cmake --build .\out\build\${{ env.CMAKE_PRESET }} --target UnleashedRecomp
- name: Pack Release
run: |
New-Item -ItemType Directory -Path .\release
New-Item -ItemType Directory -Path .\release\D3D12
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\D3D12\D3D12Core.dll" -Destination ".\release\D3D12\D3D12Core.dll"
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\dxcompiler.dll" -Destination ".\release\dxcompiler.dll"
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\dxil.dll" -Destination ".\release\dxil.dll"
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\UnleashedRecomp.exe" -Destination ".\release\UnleashedRecomp.exe"
Compress-Archive -Path .\release\* -DestinationPath .\UnleashedRecomp-Windows.zip
# Uploads the packed zip file to GitHub
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: UnleashedRecomp-Windows
# path: .\UnleashedRecomp-Windows.zip
- name: Upload artifact to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
if: ${{ env.DISCORD_WEBHOOK != '' }}
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ env.DISCORD_WEBHOOK }}
content: |
OS: Windows
Summary: ${{ env.commit_message }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
filename: .\UnleashedRecomp-Windows.zip

View file

@ -23,8 +23,7 @@
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"toolset": "ClangCL"
}
},
{
"name": "x64-Clang-Debug",

View file

@ -20,8 +20,8 @@
"name": "UnleashedRecomp",
"buildsystem": "simple",
"build-commands": [
"cmake --preset linux-release -DUNLEASHED_RECOMP_FLATPAK=ON -DSDL2MIXER_VORBIS=VORBISFILE",
"cmake --build out/build/linux-release",
"cmake --preset linux-release -DUNLEASHED_RECOMP_FLATPAK=ON -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache",
"cmake --build out/build/linux-release --target UnleashedRecomp",
"mkdir -p /app/bin",
"cp out/build/linux-release/UnleashedRecomp/UnleashedRecomp /app/bin/UnleashedRecomp",
"install -Dm644 UnleashedRecompResources/images/game_icon.png /app/share/icons/hicolor/128x128/apps/${FLATPAK_ID}.png",
@ -35,12 +35,12 @@
},
{
"type": "file",
"path": "default.xex",
"path": "private/default.xex",
"dest": "UnleashedRecompLib/private"
},
{
"type": "file",
"path": "shader.ar",
"path": "private/shader.ar",
"dest": "UnleashedRecompLib/private"
}
],