-
Notifications
You must be signed in to change notification settings - Fork 3
152 lines (133 loc) · 5.47 KB
/
Copy pathrelease-package.yml
File metadata and controls
152 lines (133 loc) · 5.47 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Release Windows portable package
on:
workflow_dispatch:
inputs:
version:
description: Version label, for example 1.4.0-beta.2
required: true
default: 1.4.0-beta.2
publish_release:
description: Create or update a GitHub Release
required: true
default: false
type: boolean
prerelease:
description: Mark GitHub Release as prerelease
required: true
default: true
type: boolean
draft:
description: Create a draft release
required: true
default: false
type: boolean
release_notes_file:
description: Markdown file used as release body
required: true
default: docs/RELEASE_NOTES_v1.4.0-beta.2.md
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
package:
name: Validate and package Windows x64
runs-on: windows-latest
timeout-minutes: 35
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Resolve release version
id: version
shell: pwsh
run: |
$version = '${{ github.event.inputs.version }}'
if ([string]::IsNullOrWhiteSpace($version)) { $version = '${{ github.ref_name }}' }
$version = $version.Trim()
if ($version.StartsWith('v')) { $version = $version.Substring(1) }
if ([string]::IsNullOrWhiteSpace($version)) { throw 'Unable to resolve release version.' }
"value=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
Write-Host "Release version: $version"
- name: Repository health gate
shell: pwsh
run: .\scripts\repository-health.ps1 -ExpectedVersion '${{ steps.version.outputs.value }}'
- name: Restore
run: dotnet restore .\ProcessBusSuite.sln
- name: Build
run: dotnet build .\ProcessBusSuite.sln -c Release --no-restore /p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test .\ProcessBusSuite.sln -c Release --no-build --logger "trx;LogFileName=release-tests.trx" --results-directory .\TestResults
- name: Publish portable package
shell: pwsh
run: .\scripts\publish-windows-portable.ps1 -Version '${{ steps.version.outputs.value }}' -Configuration Release -Runtime win-x64
- name: Verify portable package
shell: pwsh
run: |
$zip = ".\artifacts\release\ProcessBusInsight-v${{ steps.version.outputs.value }}-win-x64-portable.zip"
.\scripts\verify-release-package.ps1 -PackageZip $zip
- name: Create release manifest
shell: pwsh
run: |
$manifest = [ordered]@{
product = 'Process Bus Insight'
version = '${{ steps.version.outputs.value }}'
commit = '${{ github.sha }}'
runtime = 'win-x64'
framework = 'net8.0-windows'
communityLicense = 'GPL-3.0-or-later'
historicalBoundary = '85d43a0fe58a5888a9e8008c168ab76d2333ea87'
timestampUtc = (Get-Date).ToUniversalTime().ToString('o')
}
$manifest | ConvertTo-Json | Set-Content .\artifacts\release\release-manifest.json -Encoding utf8
- name: Upload workflow artifact
uses: actions/upload-artifact@v7
with:
name: ProcessBusInsight-v${{ steps.version.outputs.value }}-win-x64-portable
path: |
artifacts/release/ProcessBusInsight-v${{ steps.version.outputs.value }}-win-x64-portable.zip
artifacts/release/SHA256SUMS.txt
artifacts/release/release-manifest.json
TestResults/**
if-no-files-found: error
retention-days: 30
- name: Publish GitHub Release
if: ${{ github.event_name == 'push' || github.event.inputs.publish_release == 'true' }}
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$version = '${{ steps.version.outputs.value }}'
$tag = "v$version"
$zip = "artifacts/release/ProcessBusInsight-v$version-win-x64-portable.zip"
$sha = "artifacts/release/SHA256SUMS.txt"
$manifest = "artifacts/release/release-manifest.json"
$notesFile = '${{ github.event.inputs.release_notes_file }}'
if ([string]::IsNullOrWhiteSpace($notesFile)) { $notesFile = 'docs/RELEASE_NOTES_v1.4.0-beta.2.md' }
if (-not (Test-Path $notesFile)) { throw "Release notes file not found: $notesFile" }
$releaseArgs = @('release', 'create', $tag, $zip, $sha, $manifest, '--title', "Process Bus Insight $tag", '--notes-file', $notesFile, '--target', '${{ github.sha }}')
$isDraft = '${{ github.event.inputs.draft }}'
$isPrerelease = '${{ github.event.inputs.prerelease }}'
if ('${{ github.event_name }}' -eq 'push') {
$isPrerelease = if ($version -match '-') { 'true' } else { 'false' }
}
if ($isDraft -eq 'true') { $releaseArgs += '--draft' }
if ($isPrerelease -eq 'true') { $releaseArgs += '--prerelease' }
gh release view $tag *> $null
if ($LASTEXITCODE -eq 0) {
gh release upload $tag $zip $sha $manifest --clobber
} else {
gh @releaseArgs
}