Files
HATray/.github/workflows/build.yml

101 lines
3.0 KiB
YAML

name: Build
on:
push:
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install Task
uses: arduino/setup-task@v2
- name: Build Linux Binary
run: task build
- name: Get Version
id: get_version
run: |
VERSION=$(cat VERSION.txt 2>/dev/null | tr -d '\r\n' | xargs)
[ -n "$VERSION" ] || { echo "VERSION could not be acquired" && exit 1; }
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Rename Linux Binary with Version
run: mv bin/HATray bin/HATray-linux-amd64-${{ steps.get_version.outputs.VERSION }}
- name: Upload Linux Binary
uses: actions/upload-artifact@v4
with:
name: HATray-linux-amd64-${{ steps.get_version.outputs.VERSION }}
path: bin/HATray-linux-amd64-${{ steps.get_version.outputs.VERSION }}
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install Task
uses: arduino/setup-task@v2
- name: Build Windows Binary
run: task build
- name: Get Version
id: get_version_win
shell: pwsh
run: |
$version = Get-Content VERSION.txt -ErrorAction SilentlyContinue
if ([string]::IsNullOrWhiteSpace($version)) { throw "VERSION could not be acquired" }
echo "VERSION=$($version.Trim())" >> $env:GITHUB_OUTPUT
- name: Rename Windows Binary with Version
shell: pwsh
run: Rename-Item -Path bin/HATray.exe -NewName "HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.exe"
- name: Upload Windows Binary
uses: actions/upload-artifact@v4
with:
name: HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.exe
path: bin/HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.exe
if-no-files-found: error
- name: Set up .NET for WiX
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install WiX Toolset
run: dotnet tool install --global wix
- name: Add WiX Extensions
run: |
wix extension add WixToolset.Util.wixext
wix extension add WixToolset.UI.wixext
- name: Build MSI
run: task package
- name: Rename MSI with Version
shell: pwsh
run: Rename-Item -Path bin/HATray.msi -NewName "HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.msi"
- name: Upload MSI
uses: actions/upload-artifact@v4
with:
name: HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.msi
path: bin/HATray-windows-amd64-${{ steps.get_version_win.outputs.VERSION }}.msi
if-no-files-found: error