-
-
Notifications
You must be signed in to change notification settings - Fork 12
62 lines (54 loc) · 2.19 KB
/
Copy pathrelease.yml
File metadata and controls
62 lines (54 loc) · 2.19 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Install PowerShell
run: |
sudo apt-get update
sudo apt-get install -y powershell
- name: Install .NET 10 SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: Bootstrap working tree
shell: pwsh
run: ./scripts/bootstrap.ps1
- name: Derive version from tag
id: ver
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
if (-not $tag.StartsWith('v')) { throw "Tag must start with 'v' (got '$tag')" }
$ver = $tag.Substring(1)
# Expected: <base>-stratum.<rev>[-<pre>] e.g. 1.22.5-stratum.1.1 or 1.22.5-stratum.2-rc.1
if ($ver -notmatch '^(?<base>\d+\.\d+\.\d+)-stratum\.(?<rev>\d+(?:\.\d+)*)(?:-(?<pre>[0-9A-Za-z.-]+))?$') {
throw "Tag must match v<MAJOR.MINOR.PATCH>-stratum.<N[.N...]>[-<pre>] (got '$tag')"
}
$isPrerelease = if ($Matches.pre) { "true" } else { "false" }
"version=$ver" | Out-File -Append $env:GITHUB_OUTPUT
"base=$($Matches.base)" | Out-File -Append $env:GITHUB_OUTPUT
"rev=$($Matches.rev)" | Out-File -Append $env:GITHUB_OUTPUT
"pre=$($Matches.pre)" | Out-File -Append $env:GITHUB_OUTPUT
"is_prerelease=$isPrerelease" | Out-File -Append $env:GITHUB_OUTPUT
- name: Build and pack release
shell: pwsh
env:
STRATUM_VER: ${{ steps.ver.outputs.version }}
run: ./scripts/pack-release.ps1 -Rids linux-x64,linux-arm64,win-x64 -OutDir release-out -Version "${{ steps.ver.outputs.version }}"
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: release-out/*.zip
generate_release_notes: true
fail_on_unmatched_files: true
prerelease: ${{ steps.ver.outputs.is_prerelease }}