-
-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (108 loc) · 4.09 KB
/
Copy pathdotnet-release.yml
File metadata and controls
113 lines (108 loc) · 4.09 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: .NET Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
pages: write
id-token: write
checks: write
pull-requests: write
env:
BUILD_CONFIGURATION: Release
VERSION: 1.1.2
jobs:
release:
runs-on: ubuntu-latest
environment:
name: production
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore src/ServiceMonitor.slnx
- name: Build
run: dotnet build src/ServiceMonitor.slnx --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore
- name: Test
run: dotnet test src/ServiceMonitor.slnx --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger:"junit;LogFilePath=./TestResults/junit.xml" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --results-directory ./TestResults
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ./TestResults/junit.xml
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: ./TestResults/**/coverage.cobertura.xml
targetdir: ./TestResults/CoverageReport
reporttypes: Html;MarkdownSummaryGithub
- name: Write Coverage to Job Summary
run: cat ./TestResults/CoverageReport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./TestResults/CoverageReport
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Publish Linux
run: dotnet publish src/ServiceMonitor/ServiceMonitor.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --runtime linux-x64 --self-contained true --output ./publish/linux-x64
- name: Publish Windows
run: dotnet publish src/ServiceMonitor/ServiceMonitor.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --runtime win-x64 --self-contained true --output ./publish/win-x64
- name: Install dotnetpackager
run: |
dotnet tool install --global DotnetPackaging.Tool
- name: Build DEB
run: |
dotnetpackager deb from-project \
--project ./src/ServiceMonitor/ServiceMonitor.csproj \
--output ./ServiceMonitor_${{ env.VERSION }}_amd64.deb \
--service \
--service-type simple \
--service-restart on-failure \
--service-user servicemonitor
- name: Build RPM
run: |
dotnetpackager rpm from-project \
--project ./src/ServiceMonitor/ServiceMonitor.csproj \
--service \
--service-type simple \
--service-restart on-failure \
--service-user servicemonitor \
--output ./ServiceMonitor-${{ env.VERSION }}.x86_64.rpm
- name: Build AppImage
run: |
dotnetpackager appimage from-project \
--project ./src/ServiceMonitor/ServiceMonitor.csproj \
--output ./ServiceMonitor-${{ env.VERSION }}.appimage
- name: Archive Release Linux
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: 'servicemonitor-linux.zip'
path: ./publish/linux-x64
exclusions: '*.git*'
- name: Archive Release Windows
uses: thedoctor0/zip-release@0.7.5
with:
type: 'zip'
filename: 'servicemonitor-windows.zip'
path: ./publish/win-x64
exclusions: '*.git*'
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ./*.zip, ./*.deb, ./*.rpm, ./*.appimage
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}