You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AM2RModPacker/.github/workflows/main.yml

94 lines
3.0 KiB

name: Build and Upload
on:
push:
paths-ignore:
- 'README.md'
pull_request:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
configuration: [Release]
include:
- os: ubuntu-latest
COMMAND: Atomic.Gtk -p:PublishSingleFile=true -p:DebugType=embedded -r linux-x64 --no-self-contained -o builds/ubuntu-latest -p:BuildPlatform=Gtk
ARTIFACT: builds/ubuntu-latest
POSTBUILD: echo "nothing to do!"
- os: macos-latest
COMMAND: Atomic.Mac -o builds/macOS-latest
ARTIFACT: builds/macOS-latest
POSTBUILD: rm -r builds/macOS-latest/* && mv Atomic.Mac/bin/Release/net10.0-macos/Atomic.Mac.app builds/macOS-latest/Atomic.Mac.app
- os: windows-latest
COMMAND: Atomic.Wpf -p:PublishSingleFile=true -p:DebugType=embedded -r win-x86 --no-self-contained -o builds/windows-latest
ARTIFACT: builds/windows-latest
POSTBUILD: echo "nothing to do!"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.x.x
# Mac workload needs to match with a specific xcode version.
# See: https://github.com/dotnet/macios/releases
- name: Install Mac workload
working-directory: ./
run: dotnet workload install macos --version 10.0.401
if: matrix.os == 'macos-latest'
- name: Switch XCode
run: sudo xcode-select -switch /Applications/Xcode_26.6.app/Contents/Developer
if: matrix.os == 'macos-latest'
- name: Build
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/upload-artifact@v7.0.1
with:
name: ${{ matrix.os }}
path: ${{ matrix.os }}.zip
release:
runs-on: 'ubuntu-latest'
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs:
- build
permissions:
contents: write
steps:
- name: Download all the artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: artifacts/
- name: Rename Artifacts
run: |
cd artifacts
mv ./macos-latest.zip "Atomic_${{ github.ref_name }}_mac.zip"
mv ./ubuntu-latest.zip "Atomic_${{ github.ref_name }}_lin.zip"
mv ./windows-latest.zip "Atomic_${{ github.ref_name }}_win.zip"
- name: Create a Draft Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release create "${{ github.ref_name }}" artifacts/*.zip \
--draft \
--notes "Draft Release" \
--title "${{ github.ref_name }}"