-
Notifications
You must be signed in to change notification settings - Fork 2
124 lines (108 loc) · 4.3 KB
/
release-package.yml
File metadata and controls
124 lines (108 loc) · 4.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Release Windows portable package
on:
workflow_dispatch:
inputs:
version:
description: 'Version label, for example 1.2.0-public-beta'
required: true
default: '1.2.7'
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 GitHub Release as draft'
required: true
default: false
type: boolean
release_notes_file:
description: 'Markdown file used as release body'
required: true
default: 'docs/RELEASE_NOTES_v1.2.7.md'
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
package:
name: Build portable Windows package
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Show .NET SDK selection
run: dotnet --info
- 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: Restore
run: dotnet restore .\ProcessBusSuite.sln
- name: Build
run: dotnet build .\ProcessBusSuite.sln -c Release --no-restore /p:ContinuousIntegrationBuild=true
- 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: Upload workflow artifact
uses: actions/upload-artifact@v4
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
if-no-files-found: error
- 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"
$notesFile = '${{ github.event.inputs.release_notes_file }}'
if ([string]::IsNullOrWhiteSpace($notesFile)) { $notesFile = 'docs/RELEASE_NOTES_v1.2.7.md' }
if (-not (Test-Path $notesFile)) { $notesFile = 'docs/RELEASE_NOTES_v1.2.7.md' }
if (-not (Test-Path $notesFile)) { throw "Release notes file not found: $notesFile" }
$releaseArgs = @('release','create',$tag,$zip,$sha,'--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 = '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 --clobber
}
else {
gh @releaseArgs
}