-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (84 loc) · 3.58 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (84 loc) · 3.58 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
name: Release
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
name: Publish win-x64
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
global-json-file: global.json
- name: Resolve version
id: version
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$isTag = '${{ github.ref }}' -like 'refs/tags/v*'
if ($isTag) {
$ver = '${{ github.ref_name }}' -replace '^v', ''
} else {
$line = Select-String -Path 'src/IronTrace.Contracts/Versioning/IronTraceVersions.cs' -Pattern 'Application = "([^"]+)"'
$ver = $line.Matches[0].Groups[1].Value
}
"version=$ver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
"is_tag=$($isTag.ToString().ToLower())" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
Write-Host "Version: $ver (tag release: $isTag)"
- name: Publish WPF (IronTrace.exe)
run: >
dotnet publish src/IronTrace.App/IronTrace.App.csproj
-c Release -r win-x64 --self-contained true
-p:PublishSingleFile=true
-p:EnableCompressionInSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-o artifacts/publish/win-x64
- name: Publish CLI (irontrace.exe)
run: >
dotnet publish src/IronTrace.Cli/IronTrace.Cli.csproj
-c Release -r win-x64 --self-contained true
-p:PublishSingleFile=true
-p:EnableCompressionInSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-o artifacts/publish/cli
- name: Package zip
id: package
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$version = '${{ steps.version.outputs.version }}'
$zipName = "IronTrace-$version-win-x64.zip"
$staging = "artifacts/staging/IronTrace-$version-win-x64"
New-Item -ItemType Directory -Force -Path $staging | Out-Null
Copy-Item -Path 'artifacts/publish/win-x64/*' -Destination $staging -Recurse -Force
Copy-Item -Path 'artifacts/publish/cli/irontrace.exe' -Destination $staging -Force
Copy-Item -Path 'LICENSE', 'THIRD_PARTY_NOTICES.md' -Destination $staging -Force
if (Test-Path $zipName) { Remove-Item $zipName -Force }
Compress-Archive -Path $staging -DestinationPath $zipName
"zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
Write-Host "Created $zipName"
- name: Upload nightly artifact
if: steps.version.outputs.is_tag != 'true'
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: IronTrace-nightly-win-x64
path: ${{ steps.package.outputs.zip_name }}
retention-days: 7
- name: Create GitHub Release
if: steps.version.outputs.is_tag == 'true'
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
tag_name: ${{ github.ref_name }}
name: IronTrace ${{ steps.version.outputs.version }}
generate_release_notes: true
files: ${{ steps.package.outputs.zip_name }}