-
Notifications
You must be signed in to change notification settings - Fork 5
105 lines (93 loc) · 3.64 KB
/
Copy pathrelease.yml
File metadata and controls
105 lines (93 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Publish release
# Manual release: packages the Windows WPF + Avalonia bundle for win-x64 and win-arm64 via
# scripts/package-release.ps1 and the self-contained Linux bundle for linux-x64 and linux-arm64
# via scripts/package-release-linux.ps1, uploads the zips as workflow artifacts and
# creates/updates the GitHub release the in-app updater reads.
#
# Assets produced per RID:
# release_{version}_{rid}.zip Windows: SimpleLauncher.exe + SimpleLauncher.Avalonia.exe side by side
# Linux: the self-contained SimpleLauncher.Avalonia payload
# updater_{rid}.zip the standalone updater shared by the apps (Updater.exe / Updater)
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish, must match the csproj (e.g. 5.8.0)'
required: true
type: string
create_release:
description: 'Create or update the GitHub release and attach the packages'
required: true
type: boolean
default: true
release_notes:
description: 'Optional release notes (markdown). Leave empty to auto-generate.'
required: false
type: string
default: ''
permissions:
contents: write
concurrency:
group: release-${{ inputs.version }}
cancel-in-progress: false
jobs:
publish:
name: Package release bundles (win-x64, win-arm64, linux-x64, linux-arm64)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: Package Windows release
shell: pwsh
env:
VERSION: ${{ inputs.version }}
run: >
./scripts/package-release.ps1
-Version $env:VERSION
-OutputDir '${{ github.workspace }}/artifacts/release'
-WorkDir '${{ runner.temp }}/sl-publish'
- name: Package Linux release
shell: pwsh
env:
VERSION: ${{ inputs.version }}
run: >
./scripts/package-release-linux.ps1
-Version $env:VERSION
-OutputDir '${{ github.workspace }}/artifacts/release'
-WorkDir '${{ runner.temp }}/sl-publish-linux'
- name: Upload packages as workflow artifacts
uses: actions/upload-artifact@v7
with:
name: simplelauncher-${{ inputs.version }}
path: artifacts/release/*.zip
retention-days: 7
- name: Create or update GitHub release
if: ${{ inputs.create_release }}
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ inputs.version }}
RELEASE_NOTES: ${{ inputs.release_notes }}
run: |
$tag = "release$env:VERSION"
$assets = Get-ChildItem -LiteralPath 'artifacts/release' -Filter '*.zip' | ForEach-Object { $_.FullName }
gh release view $tag *> $null
if ($LASTEXITCODE -ne 0) {
Write-Host "Creating release $tag"
if ([string]::IsNullOrWhiteSpace($env:RELEASE_NOTES)) {
gh release create $tag --target $env:GITHUB_SHA --title "Version $env:VERSION" --generate-notes
}
else {
$notesFile = Join-Path $env:RUNNER_TEMP 'release-notes.md'
Set-Content -LiteralPath $notesFile -Value $env:RELEASE_NOTES -Encoding utf8
gh release create $tag --target $env:GITHUB_SHA --title "Version $env:VERSION" --notes-file $notesFile
}
}
else {
Write-Host "Release $tag already exists, updating its assets"
}
gh release upload $tag $assets --clobber