-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (68 loc) · 2.06 KB
/
dotnet-desktop.yml
File metadata and controls
84 lines (68 loc) · 2.06 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
name: .NET Desktop CI/CD
on:
push:
branches: [ main, develop ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest
env:
Solution_Name: WPFBase.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Restore dependencies
run: dotnet restore ${{ env.Solution_Name }}
- name: Build
run: dotnet build ${{ env.Solution_Name }} --configuration ${{ matrix.configuration }} --no-restore
- name: Test
run: dotnet test ${{ env.Solution_Name }} --no-build --configuration ${{ matrix.configuration }} --verbosity normal --logger "trx;LogFileName=test-results.trx"
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.configuration }}
path: '**/test-results.trx'
- name: Create Release Package
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
run: |
dotnet publish ${{ env.Solution_Name }} --configuration Release --output ./publish
- name: Archive Release
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: release-package
path: ./publish
release:
needs: build
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-package
path: ./release
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: ./release/**/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}