Added more Linux related stuff #6
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 Project | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- ui | |
- main | |
env: | |
PROJECT_PATH: ./Source/HedgeModManager.UI/HedgeModManager.UI.csproj | |
FLATPAK_ID: io.github.hedge_dev.hedgemodmanager | |
GENERATOR_URL: https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/refs/heads/master/dotnet/flatpak-dotnet-generator.py | |
DOTNET_VERSION: 8 | |
DOTNET_CLI_HOME: /tmp/.dotnet | |
FREEDESKTOP_VERSION: 24.08 | |
jobs: | |
build: | |
name: Build Project | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
rid: [linux-x64, win-x64] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET ${{ env.DOTNET_VERSION }} SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }}.0.x | |
- name: Setup .NET ${{ env.DOTNET_VERSION }} Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DOTNET_CLI_HOME }} | |
key: dotnet-${{ env.DOTNET_VERSION }}-${{ matrix.rid }} | |
restore-keys: | | |
dotnet-${{ env.DOTNET_VERSION }}- | |
- name: Restore Packages | |
run: dotnet restore ${{ env.PROJECT_PATH }} | |
- name: ${{ matrix.rid }} Build | |
run: dotnet publish -p:PublishProfile=${{ matrix.rid }} -c Release -o ./output/${{ matrix.rid }} ${{ env.PROJECT_PATH }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HedgeModManager-${{matrix.rid}} | |
path: ./output/${{matrix.rid}} | |
build-flatpak: | |
name: Build Flatpak | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Flatpak Builder | |
run: | | |
sudo apt-get update | |
sudo apt-get install flatpak-builder -y | |
- name: Setup Flatpak Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/flatpak/runtime/ | |
key: flatpak-${{ env.FREEDESKTOP_VERSION }}-x86_64 | |
- name: Setup Flatpak | |
run: | | |
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
flatpak install --user -y flathub org.freedesktop.Sdk//${{env.FREEDESKTOP_VERSION}} | |
flatpak install --user -y flathub org.freedesktop.Sdk.Extension.dotnet${{env.DOTNET_VERSION}}//${{env.FREEDESKTOP_VERSION}} | |
- name: Generate NuGet Sources | |
run: | | |
curl -o flatpak-dotnet-generator.py ${{env.GENERATOR_URL}} | |
chmod +x flatpak-dotnet-generator.py | |
python3 flatpak-dotnet-generator.py ./flatpak/nuget-sources.json ${{env.PROJECT_PATH}} --dotnet ${{env.DOTNET_VERSION}} --freedesktop ${{env.FREEDESKTOP_VERSION}} | |
- name: Build Flatpak | |
env: | |
APP_VERSION: ${{ github.event.inputs.version }} | |
run: flatpak-builder --user --force-clean --install-deps-from=flathub --repo=repo builddir ./flatpak/${{ env.FLATPAK_ID }}-autobuild.yml | |
- name: Build Flatpak Bundle | |
env: | |
APP_VERSION: ${{ github.event.inputs.version }} | |
run: flatpak build-bundle repo ./flatpak/${{env.FLATPAK_ID}}.flatpak ${{env.FLATPAK_ID}} | |
- name: Upload Flatpak Bundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HedgeModManager-flatpak-x86_64 | |
path: ./flatpak/${{env.FLATPAK_ID}}.flatpak | |
- name: Upload NuGet Sources | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-sources.json | |
path: ./flatpak/nuget-sources.json |