-
Notifications
You must be signed in to change notification settings - Fork 25
96 lines (95 loc) · 3.17 KB
/
commit.yml
File metadata and controls
96 lines (95 loc) · 3.17 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
name: Commit
on:
push:
pull_request:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build solution
run: dotnet build -c Release
- name: Run tests
run: dotnet test -c Release --no-build --verbosity normal
- name: Pack NuGet packages
run: dotnet pack -c Release --no-build -o nuget
- name: Upload nuget packages as artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet
path: nuget
if-no-files-found: error
retention-days: 1
publish-app:
name: Publish Application
needs: [build]
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.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '6.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
- name: Set VERSION environment variable
run: |
$version = "${{ steps.gitversion.outputs.fullSemVer }}"
Add-Content $env:GITHUB_ENV "VERSION=$version"
- name: Normalize version
run: |
$rawVersion = $env:VERSION
$safeVersion = $rawVersion -replace '[^a-zA-Z0-9\.\-]', '_'
Add-Content $env:GITHUB_ENV "SAFE_VERSION=$safeVersion"
- name: Publish Self-Contained
run: |
dotnet publish app/Sentinel.NLogViewer.App/Sentinel.NLogViewer.App.csproj `
-c Release `
-p:SelfContained=true `
-p:PublishSingleFile=true `
-p:RuntimeIdentifier=win-x64 `
-p:Version=$env:VERSION `
-p:IncludeNativeLibrariesForSelfExtract=true `
-o publish/self-contained
- name: Publish Framework-Dependent
run: |
dotnet publish app/Sentinel.NLogViewer.App/Sentinel.NLogViewer.App.csproj `
-c Release `
-p:SelfContained=false `
-p:RuntimeIdentifier=win-x64 `
-p:Version=$env:VERSION `
-o publish/framework-dependent
- name: Rename folders with version
run: |
$version = $env:SAFE_VERSION
Rename-Item -Path "publish/self-contained" -NewName "NLogViewer-SelfContained-win-x64-$version"
Rename-Item -Path "publish/framework-dependent" -NewName "NLogViewer-FrameworkDependent-win-x64-$version"
- name: Upload Self-Contained artifact
uses: actions/upload-artifact@v4
with:
name: NLogViewer-SelfContained-win-x64-${{ env.SAFE_VERSION }}
path: publish/NLogViewer-SelfContained-win-x64-${{ env.SAFE_VERSION }}
if-no-files-found: error
retention-days: 1
- name: Upload Framework-Dependent artifact
uses: actions/upload-artifact@v4
with:
name: NLogViewer-FrameworkDependent-win-x64-${{ env.SAFE_VERSION }}
path: publish/NLogViewer-FrameworkDependent-win-x64-${{ env.SAFE_VERSION }}
if-no-files-found: error
retention-days: 1