155 lines
4.6 KiB
YAML
155 lines
4.6 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: build-${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
platform: windows/amd64
|
|
package: windows
|
|
- os: macos-latest
|
|
platform: darwin/universal
|
|
package: macos-universal
|
|
- os: ubuntu-22.04
|
|
platform: linux/amd64
|
|
package: linux
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.22.x"
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20.x"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install Wails
|
|
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
|
|
|
- name: Install Linux build dependencies
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev pkg-config
|
|
|
|
- name: Build
|
|
if: matrix.os != 'windows-latest'
|
|
run: wails build -clean -platform ${{ matrix.platform }}
|
|
|
|
- name: Build (Windows installer)
|
|
if: matrix.os == 'windows-latest'
|
|
shell: pwsh
|
|
run: |
|
|
choco install nsis -y
|
|
$env:Path = "C:\Program Files (x86)\NSIS;" + $env:Path
|
|
if (-not (Get-Command makensis -ErrorAction SilentlyContinue)) {
|
|
Write-Error "makensis not found after NSIS install"
|
|
}
|
|
wails build -clean -nsis -platform windows/amd64
|
|
|
|
- name: Package (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
shell: pwsh
|
|
run: |
|
|
Write-Host "Listing build/bin contents:"
|
|
Get-ChildItem -Path build/bin -Recurse | Select-Object FullName | Format-Table -AutoSize
|
|
|
|
$installer = Get-ChildItem -Path build/bin -Recurse -File -Filter "*.exe" |
|
|
Where-Object { $_.Name -match "installer|setup" } |
|
|
Select-Object -First 1
|
|
|
|
if (-not $installer) {
|
|
$installer = Get-ChildItem -Path build/bin -Recurse -File -Filter "*.msi" | Select-Object -First 1
|
|
}
|
|
|
|
if (-not $installer) {
|
|
Write-Error "No Windows installer found in build/bin"
|
|
}
|
|
$renamed = Join-Path $installer.DirectoryName "XSL-PrintDot-setup-windows.exe"
|
|
Copy-Item -Path $installer.FullName -Destination $renamed -Force
|
|
Compress-Archive -Path $renamed -DestinationPath build/XSL-PrintDot-windows.zip
|
|
|
|
- name: Package (macOS)
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
APP_PATH=$(find build/bin -maxdepth 2 -type d -name "*.app" | head -n 1)
|
|
if [ -z "$APP_PATH" ]; then
|
|
echo "No .app found in build/bin" >&2
|
|
exit 1
|
|
fi
|
|
if [ ! -d "$APP_PATH/Contents" ]; then
|
|
echo "Invalid .app bundle: $APP_PATH" >&2
|
|
exit 1
|
|
fi
|
|
echo "Packaging $APP_PATH"
|
|
|
|
APP_NAME=$(basename "$APP_PATH" .app)
|
|
BIN_PATH="$APP_PATH/Contents/MacOS/$APP_NAME"
|
|
if [ ! -f "$BIN_PATH" ]; then
|
|
echo "Binary not found: $BIN_PATH" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ARM_APP="build/bin/${APP_NAME}-arm64.app"
|
|
AMD_APP="build/bin/${APP_NAME}-amd64.app"
|
|
|
|
rm -rf "$ARM_APP" "$AMD_APP"
|
|
cp -R "$APP_PATH" "$ARM_APP"
|
|
cp -R "$APP_PATH" "$AMD_APP"
|
|
|
|
lipo -thin arm64 "$BIN_PATH" -output "$ARM_APP/Contents/MacOS/$APP_NAME"
|
|
lipo -thin x86_64 "$BIN_PATH" -output "$AMD_APP/Contents/MacOS/$APP_NAME"
|
|
|
|
ditto -c -k --sequesterRsrc --keepParent "$ARM_APP" build/XSL-PrintDot-macos-arm64.zip
|
|
ditto -c -k --sequesterRsrc --keepParent "$AMD_APP" build/XSL-PrintDot-macos-amd64.zip
|
|
|
|
- name: Package (Linux)
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
run: |
|
|
if [ ! -d "build/bin" ]; then
|
|
echo "build/bin not found" >&2
|
|
exit 1
|
|
fi
|
|
tar -czf build/XSL-PrintDot-linux.tar.gz -C build/bin .
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: XSL-PrintDot-${{ matrix.os }}
|
|
path: build/XSL-PrintDot-*
|
|
|
|
release:
|
|
name: create-release
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Publish Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*
|