-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 3.3 KB
/
Copy pathrelease.yml
File metadata and controls
102 lines (90 loc) · 3.3 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
name: Release
# Tag-triggered release pipeline. Tagging vX.Y.Z is the single trigger that
# builds, packages, signs, and publishes the GitHub Release whose assets the
# in-app updater and tray notifier consume.
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Existing vX.Y.Z tag to (re-)release.
required: true
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
release:
name: Build, package, and publish release
runs-on: windows-latest
environment: release
env:
AVALONIA_UI_LICENSE_KEY: ${{ secrets.AVALONIA_UI_LICENSE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.tag || github.ref }}
submodules: recursive
fetch-depth: 0
- name: Set up build
uses: ./.github/actions/setup-build
- name: Derive version from tag
id: version
shell: pwsh
run: |
$ref = "${{ github.event.inputs.tag || github.ref_name }}"
$tag = $ref -replace '^refs/tags/', ''
if ($tag -notmatch '^v\d+\.\d+\.\d+') {
throw "Tag '$tag' is not a vX.Y.Z release tag."
}
$version = $tag.TrimStart('v')
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Releasing version $version (tag $tag)"
- name: Build (Release)
shell: pwsh
run: dotnet build Phantom.Workspaces.slnx -c Release --no-restore
- name: Run test suite (release gate)
shell: pwsh
run: .\scripts\run-tests.ps1 -Mode fast
- name: Upload test results log
if: always()
uses: actions/upload-artifact@v7
with:
name: release-test-results-log
path: scripts/test-results.log
if-no-files-found: warn
- name: Publish and package per architecture
id: package
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
$output = Join-Path $env:RUNNER_TEMP 'release-assets'
New-Item -ItemType Directory -Force -Path $output | Out-Null
foreach ($rid in @('win-x64', 'win-arm64')) {
$publishDir = Join-Path $env:RUNNER_TEMP "publish/$rid"
dotnet publish Phantom.Workspaces/Phantom.Workspaces.csproj `
-c Release -r $rid `
-p:Version=$version -o $publishDir
if ($LASTEXITCODE -ne 0) { throw "publish failed for $rid" }
.\packaging\zip\New-ReleaseZip.ps1 `
-PublishDirectory $publishDir -Version $version `
-RuntimeIdentifier $rid -OutputDirectory $output
}
"assets=$output" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Create GitHub Release
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$tag = "${{ steps.version.outputs.tag }}"
$assets = "${{ steps.package.outputs.assets }}"
$files = Get-ChildItem -LiteralPath $assets -File | ForEach-Object { $_.FullName }
gh release create $tag $files `
--title $tag `
--generate-notes `
--verify-tag