-
Notifications
You must be signed in to change notification settings - Fork 20
66 lines (52 loc) · 2.17 KB
/
ci.yml
File metadata and controls
66 lines (52 loc) · 2.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
name: CI
on:
pull_request:
branches: [master]
env:
DOTNET_VERSION: '9.0.x'
CONFIGURATION: Release
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Set version with commit hash
shell: pwsh
run: |
$commitSha = "${{ github.sha }}".Substring(0, 7)
$filePath = "Directory.Build.props"
$content = Get-Content $filePath -Raw
$content = $content -replace '<InformationalVersion>.*?</InformationalVersion>', "<InformationalVersion>0.0.0+$commitSha</InformationalVersion>"
Set-Content $filePath $content -NoNewline
Write-Host "InformationalVersion set to: 0.0.0+$commitSha"
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Run tests
run: dotnet test --configuration ${{ env.CONFIGURATION }} --no-build --verbosity normal
- name: Publish WinForms app
run: dotnet publish CollectionManager.App.WinForms/CollectionManager.App.WinForms.csproj -f net9.0-windows -p:PublishProfile=FolderProfile
- name: Publish CLI app
run: dotnet publish CollectionManager.App.Cli/CollectionManager.App.Cli.csproj -f net9.0 -p:PublishProfile=FolderProfile
- name: Zip WinForms app
shell: pwsh
run: |
New-Item -ItemType Directory -Path ./artifacts -Force
Compress-Archive -Path ./CollectionManager.App.WinForms/bin/publish/* -DestinationPath ./artifacts/CollectionManager-WinForms.zip
- name: Zip CLI app
shell: pwsh
run: |
Compress-Archive -Path ./CollectionManager.App.Cli/bin/publish/* -DestinationPath ./artifacts/CollectionManager-CLI.zip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
artifacts/CollectionManager-WinForms.zip
artifacts/CollectionManager-CLI.zip