134 lines
4.6 KiB
YAML
134 lines
4.6 KiB
YAML
name: Build G-Launcher Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag_name:
|
|
description: 'Release Tag Name (e.g. latest, release, v1.0.0)'
|
|
required: false
|
|
default: 'release'
|
|
custom_version:
|
|
description: 'Override Version (leave blank for auto-increment)'
|
|
required: false
|
|
default: ''
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: build-g-launcher-release
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache-dependency-path: go.sum
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install Wails CLI
|
|
shell: pwsh
|
|
run: |
|
|
go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-alpha.74
|
|
"$env:USERPROFILE\go\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
- name: Calculate launcher version
|
|
shell: pwsh
|
|
run: |
|
|
$customVersion = "${{ github.event.inputs.custom_version }}"
|
|
$releaseTag = if ("${{ github.event.inputs.tag_name }}") { "${{ github.event.inputs.tag_name }}" } else { "release" }
|
|
|
|
if ($customVersion -and $customVersion.Trim() -ne "") {
|
|
$version = $customVersion.Trim()
|
|
Write-Host "Using user-specified version: $version"
|
|
} else {
|
|
$manifestPath = Join-Path $env:RUNNER_TEMP "latest.json"
|
|
# Attempt to fetch latest.json from current repository release
|
|
$repo = "${{ github.repository }}"
|
|
$manifestUrl = "https://github.com/$repo/releases/download/$releaseTag/latest.json"
|
|
$cacheBust = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()
|
|
$requestUrl = "$($manifestUrl)?cachebust=$cacheBust"
|
|
|
|
Write-Host "Checking current manifest from: $requestUrl"
|
|
$status = & curl.exe --location --silent --show-error --output $manifestPath --write-out "%{http_code}" $requestUrl
|
|
|
|
if ($status -eq "200") {
|
|
$currentVersion = (Get-Content -Raw $manifestPath | ConvertFrom-Json).version
|
|
Write-Host "Found previous version: $currentVersion"
|
|
$version = node scripts/launcher-release.mjs next $currentVersion
|
|
} else {
|
|
Write-Host "No previous manifest found (HTTP $status). Starting at 1.0.0"
|
|
$version = "1.0.0"
|
|
}
|
|
}
|
|
|
|
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "LAUNCHER_VERSION=$version" + [Environment]::NewLine)
|
|
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "RELEASE_TAG=$releaseTag" + [Environment]::NewLine)
|
|
|
|
node scripts/launcher-release.mjs stamp-info $version build/windows/info.json
|
|
Write-Host "Configured G-Launcher version $version"
|
|
|
|
- name: Install Frontend Dependencies
|
|
working-directory: frontend
|
|
run: npm ci
|
|
|
|
- name: Build Frontend
|
|
working-directory: frontend
|
|
run: npm run build
|
|
|
|
- name: Build Windows Executable
|
|
shell: pwsh
|
|
run: |
|
|
wails3 task build BUILD_VERSION=$env:LAUNCHER_VERSION PRODUCTION=true
|
|
env:
|
|
PRODUCTION: "true"
|
|
|
|
- name: Prepare Release Assets
|
|
shell: pwsh
|
|
run: |
|
|
$builtLauncher = "bin/G-Launcher.exe"
|
|
if (!(Test-Path $builtLauncher)) {
|
|
$fallback = Get-ChildItem -Path "bin" -Filter "*.exe" | Select-Object -First 1
|
|
if ($fallback) {
|
|
$builtLauncher = $fallback.FullName
|
|
} else {
|
|
throw "Build output was not found in bin directory."
|
|
}
|
|
}
|
|
|
|
$releaseLauncher = Join-Path $env:RUNNER_TEMP "G-Launcher.exe"
|
|
Copy-Item -LiteralPath $builtLauncher -Destination $releaseLauncher -Force
|
|
|
|
$manifestPath = Join-Path $env:RUNNER_TEMP "latest.json"
|
|
node scripts/launcher-release.mjs manifest $env:LAUNCHER_VERSION $releaseLauncher $manifestPath
|
|
|
|
Write-Host "Release assets prepared:"
|
|
Get-Item $releaseLauncher, $manifestPath | Select-Object Name, Length
|
|
|
|
- name: Publish Release Assets
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ env.RELEASE_TAG }}
|
|
files: |
|
|
${{ runner.temp }}/G-Launcher.exe
|
|
${{ runner.temp }}/latest.json
|
|
overwrite_files: true
|
|
fail_on_unmatched_files: true
|