Skip to content

Build And Publish

Build And Publish #23

name: Build And Publish
on:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
configuration: [Release]
include:
- os: ubuntu-latest
COMMAND: AM2RLauncher.Gtk -p:PublishSingleFile=true -p:DebugType=embedded -r ubuntu.18.04-x64 --no-self-contained -o builds/ubuntu-latest
ARTIFACT: AM2RLauncher/builds/ubuntu-latest
POSTBUILD: echo "No post build to do!"
- os: macos-13
COMMAND: AM2RLauncher.Mac -o builds/macOS-latest
ARTIFACT: AM2RLauncher/builds/macOS-latest
POSTBUILD: rm -r AM2RLauncher/builds/macOS-latest/* && mv AM2RLauncher/AM2RLauncher.Mac/bin/Release/net6.0-macos/AM2RLauncher.Mac.app AM2RLauncher/builds/macOS-latest/AM2RLauncher.Mac.app
- os: windows-latest
COMMAND: AM2RLauncher.Wpf -r win-x86
ARTIFACT: AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\
# This is very ugly, *please* tell me a better way to do this
POSTBUILD: mv AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\AM2RLauncher.Wpf.exe AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\AM2RLauncher.exe && mv AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\AM2RLauncher.Wpf.exe.config AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\AM2RLauncher.exe.config && rmdir AM2RLauncher\AM2RLauncher.Wpf\bin\Release\net48\win-x86\publish -Recurse
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
- name: Install Mac workload
working-directory: ./AM2RLauncher
run: dotnet workload install macos && dotnet workload restore
- name: Restore dependencies
working-directory: ./AM2RLauncher
run: dotnet restore
- name: Switch XCode
run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app/Contents/Developer
if: matrix.os == 'macos-13'
- name: Build
working-directory: ./AM2RLauncher
run: dotnet publish ${{ matrix.COMMAND }} -c "${{ matrix.configuration }}"
- name: Post-Build
run: |
cp ./LICENSE ./${{ matrix.ARTIFACT }}/
${{ matrix.POSTBUILD }}
# Steps for uploading artifacts.
- name: Zip to Archive
run: 7z a -tzip ${{ matrix.os }}.zip ./${{ matrix.ARTIFACT }}
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ matrix.os }}
path: ${{ matrix.os }}.zip