Skip to content

Build

Build #78

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
publish-release:
description: 'Publish Release'
type: boolean
default: false
publish-pre-release:
description: 'Mark as Pre-Release'
type: boolean
default: false
version-number:
description: 'Version Number for Release'
type: string
release-name-info:
description: 'Additional info to put at the end of the release name'
type: string
required: false
release-notes:
description: 'Release notes, auto generated if not given'
type: string
required: false
publish-steam:
description: 'Publish on Steam'
type: boolean
default: false
jobs:
build-linux:
defaults:
run:
shell: bash
strategy:
matrix:
include:
- { result: Baballonia.x64.tar.xz, runs-on: ubuntu-22.04, upload-path: src/Baballonia.Desktop/bin/Baballonia.x64.tar.xz, arch: linux-x64 }
- { result: Baballonia.arm64.tar.xz, runs-on: ubuntu-22.04-arm, upload-path: src/Baballonia.Desktop/bin/Baballonia.arm64.tar.xz, arch: linux-arm64 }
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout latest
uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Download dependencies
run: ./download_dependencies.sh
#- name: Install dependencies
# run: |
# dotnet tool install -g vpk
- name: Run publish
run: |
cd src/Baballonia.Desktop
dotnet publish -r ${{ matrix.arch }} -c Release --self-contained -f net10.0
cd "bin/Release/net10.0/${{ matrix.arch }}/publish"
tar -cJf ./../../../../${{ matrix.result }} *
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.result }}
path: ${{ matrix.upload-path }}
build-windows-x64:
defaults:
run:
shell: bash
runs-on: windows-2022
steps:
- name: Checkout latest
uses: actions/checkout@v5
with:
submodules: 'recursive'
lfs: true
- name: Install NSIS
uses: negrutiu/nsis-install@v2
with:
arch: x64
- name: Download dependencies
shell: pwsh
run: ./download_dependencies.ps1
- name: Build project
run: |
cd src/Baballonia.Desktop
dotnet publish -r win-x64 -c Release --self-contained -f net10.0
cd "bin/Release/net10.0/win-x64/publish"
tar -cJf ./../../../../Baballonia.win.tar.xz *
- name: Run makensis
run: |
cd src/Baballonia.Desktop
makensis -DWORKFLOW_VERSION="${{ github.event.inputs.version-number }}" main.nsi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: "Baballonia Setup.exe"
path: "src/Baballonia.Desktop/Baballonia Setup.exe"
- name: Upload tarball artifact
uses: actions/upload-artifact@v4
with:
name: "Baballonia.win.tar.xz"
path: "src/Baballonia.Desktop/bin/Baballonia.win.tar.xz"
publish-release:
needs: [build-linux, build-windows-x64]
if: ${{ github.event.inputs.publish-release == 'true' }}
defaults:
run:
shell: bash
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Validate version number exists
run: |
if [ -z "${{ github.event.inputs.version-number }}" ]; then
exit 1
fi
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: "Baballonia Setup.exe"
path: ./artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: Baballonia.x64.tar.xz
path: ./artifacts
- name: Download Linux ARM artifact
uses: actions/download-artifact@v4
with:
name: Baballonia.arm64.tar.xz
path: ./artifacts
- name: Rename artifacts
env:
VERSION: ${{ github.event.inputs.version-number }}
run: |
cd artifacts
mv "Baballonia Setup.exe" "Baballonia.Setup.${VERSION}.exe"
mv "Baballonia.x64.tar.xz" "Baballonia.x64.${VERSION}.tar.xz"
mv "Baballonia.arm64.tar.xz" "Baballonia.arm64.${VERSION}.tar.xz"
- name: Set dynamic release name
id: release-name
run: |
if [[ -z "${{ github.event.inputs.release-name-info }}" ]]; then
echo "name=${{ github.event.inputs.version-number }}" >> "$GITHUB_OUTPUT"
else
echo "name=${{ github.event.inputs.version-number }} - ${{ github.event.inputs.release-name-info }}" >> "$GITHUB_OUTPUT"
fi
- name: Set release body or generate notes
id: release-body
run: |
if [[ -z "${{ github.event.inputs.release-notes }}" ]]; then
echo "generate_notes=true" >> "$GITHUB_OUTPUT"
echo "body=" >> "$GITHUB_OUTPUT"
else
echo "generate_notes=false" >> "$GITHUB_OUTPUT"
echo "body<<EOF" >> "$GITHUB_OUTPUT"
echo "${{ github.event.inputs.release-notes }}" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/Baballonia.Setup.${{ github.event.inputs.version-number }}.exe
artifacts/Baballonia.x64.${{ github.event.inputs.version-number }}.tar.xz
artifacts/Baballonia.arm64.${{ github.event.inputs.version-number }}.tar.xz
tag_name: ${{ github.event.inputs.version-number }}
name: ${{ steps.release-name.outputs.name }}
prerelease: ${{ github.event.inputs.publish-pre-release }}
body: ${{ steps.release-body.outputs.body }}
generate_release_notes: ${{ steps.release-body.outputs.generate_notes }}
publish-steam:
needs: [build-linux, build-windows-x64]
if: ${{ github.event.inputs.publish-steam == 'true' }}
defaults:
run:
shell: bash
runs-on: ubuntu-22.04
steps:
- name: Validate version number exists
run: |
if [ -z "${{ github.event.inputs.version-number }}" ]; then
exit 1
fi
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: Baballonia.win.tar.xz
path: ./artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: Baballonia.x64.tar.xz
path: ./artifacts
#- name: Download Linux ARM artifact
# uses: actions/download-artifact@v4
# with:
# name: Baballonia.arm64.tar.xz
# path: ./artifacts
- name: Untar artifacts
run: |
mkdir -p ./builds/windows
mkdir -p ./builds/linux-x64
tar -xf ./artifacts/Baballonia.win.tar.xz --directory ./builds/windows
tar -xf ./artifacts/Baballonia.x64.tar.xz --directory ./builds/linux-x64
- name: Upload to Steam
uses: game-ci/steam-deploy@v3
with:
username: ${{ secrets.STEAM_USERNAME }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF }}
appId: 4091970
buildDescription: ${{ github.event.inputs.version-number }}
depot2Path: builds/windows
depot3Path: builds/linux-x64
releaseBranch: prerelease