Repository navigation
85 lines (74 loc) · 3.78 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (74 loc) · 3.78 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
# A version tag (v0.1.0): test, build the installer with that version, and publish it as a GitHub Release.
# 0.x versions and versions with a suffix (v1.0.0-rc1) are marked as pre-releases.
# The release text is release-notes/<tag>.md (release-notes/v1.2.0.md), followed by GitHub's generated list of changes.
# A release needs its notes file; a pre-release without one gets the generated list only.
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# Checked first, so a missing notes file fails the run in seconds rather than after the build.
- name: Find the release notes
id: notes
shell: pwsh
run: |
$tag = '${{ github.ref_name }}'
$version = $tag.TrimStart('v')
$prerelease = $version.StartsWith('0.') -or $version.Contains('-')
$file = "release-notes/$tag.md"
if (Test-Path $file) {
if (-not (Get-Content $file -Raw).Trim()) { throw "$file is empty: write the release notes, then tag again" }
"file=$file" >> $env:GITHUB_OUTPUT
} elseif ($prerelease) {
Write-Host "::notice::No $file; the pre-release gets GitHub's generated notes only"
} else {
throw "No release notes for $tag. Add $file (see release-notes/README.md), then tag again."
}
"prerelease=$($prerelease.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
# WinFsp with its Developer part: the build references its .NET API (bin\winfsp-msil.dll), which a default
# install (choco's too) leaves out. The same version as the developers' PCs; the smoke test mounts with it.
# The installer is cached so a GitHub release-download hiccup (504s happen) doesn't fail the run; a cache miss retries.
- name: Cache the WinFsp installer
uses: actions/cache@v4
with:
path: winfsp.msi
key: winfsp-2.1.25156
- name: Install WinFsp
shell: pwsh
run: |
if (-not (Test-Path winfsp.msi)) {
Invoke-WebRequest https://github.com/winfsp/winfsp/releases/download/v2.1/winfsp-2.1.25156.msi -OutFile winfsp.msi -MaximumRetryCount 5 -RetryIntervalSec 15
}
Start-Process msiexec.exe -ArgumentList '/i', 'winfsp.msi', '/qn', 'ADDLOCAL=F.Main,F.User,F.Developer' -Wait
if (-not (Test-Path "${env:ProgramFiles(x86)}\WinFsp\bin\winfsp-msil.dll")) { throw "WinFsp's .NET API (winfsp-msil.dll) was not installed" }
- name: Test
run: dotnet test --solution OrthoStreamXP.slnx -c Release
- name: Build the installer
shell: pwsh
run: .\build-installer.ps1 -Version ('${{ github.ref_name }}'.TrimStart('v'))
# The user guide PDF is built locally (build-user-guide.ps1) and committed with the docs.
- name: Add the user guide
shell: pwsh
run: Copy-Item docs\OrthoStreamXP-UserGuide.pdf artifacts\releases
- name: Create the GitHub Release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
NOTES_FILE: ${{ steps.notes.outputs.file }}
PRERELEASE: ${{ steps.notes.outputs.prerelease }}
run: |
$version = '${{ github.ref_name }}'.TrimStart('v')
# With --generate-notes, the notes file comes first and GitHub's list of changes is added after it.
$flags = @('--title', "OrthoStreamXP $version", '--generate-notes')
if ($env:NOTES_FILE) { $flags += @('--notes-file', $env:NOTES_FILE) }
if ($env:PRERELEASE -eq 'true') { $flags += '--prerelease' }
gh release create '${{ github.ref_name }}' (Get-ChildItem artifacts\releases -File).FullName @flags