Skip to content

Commit bc600c3

Browse files
committed
Update workflows
1 parent deff6ea commit bc600c3

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

.github/workflows/dotnet.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
5+
branches: [ main, dev ]
86

97
jobs:
108
build:
@@ -14,18 +12,35 @@ jobs:
1412
strategy:
1513
matrix:
1614
os: [ubuntu-latest, windows-latest]
17-
15+
1816
steps:
19-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
18+
2019
- name: Setup .NET
21-
uses: actions/setup-dotnet@v3
20+
uses: actions/setup-dotnet@v4
2221
with:
2322
dotnet-version: |
24-
6.0.x
25-
7.0.x
23+
8.0.x
24+
2625
- name: Restore dependencies
2726
run: dotnet restore
27+
2828
- name: Build
29-
run: dotnet build --no-restore
29+
run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true
30+
3031
- name: Test
31-
run: dotnet test --no-build --verbosity normal
32+
run: dotnet test -c Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
33+
34+
- name: Code Coverage Report
35+
uses: irongut/[email protected]
36+
if: matrix.os == 'ubuntu-latest'
37+
with:
38+
filename: coverage/**/coverage.cobertura.xml
39+
badge: true
40+
fail_below_min: true
41+
format: text
42+
hide_branch_rate: false
43+
hide_complexity: true
44+
indicators: true
45+
output: both
46+
thresholds: '60 80'

.github/workflows/publish.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,59 @@ on:
66

77
permissions:
88
contents: write # important for release description edit and asset upload
9+
packages: write
910

1011
jobs:
11-
build:
12-
name: Build
12+
build-and-publish:
13+
name: Build and Publish
1314

1415
runs-on: ubuntu-latest
1516

1617
env:
1718
GH_TOKEN: ${{ github.token }}
1819

1920
steps:
20-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
22+
23+
- name: Set release information
24+
run: gh release edit ${{ github.ref_name }} -n "$(echo -e '***[Pre-release is being automatically created, please wait...](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})***\n\n${{ github.event.release.body }}')"
2125

2226
- name: Setup .NET
23-
uses: actions/setup-dotnet@v1
27+
uses: actions/setup-dotnet@v4
2428
with:
2529
dotnet-version: |
26-
7.0.x
27-
6.0.x
30+
8.0.x
2831
2932
- name: Restore dependencies
3033
run: dotnet restore
3134

3235
- name: Build
33-
run: dotnet build -c Release --no-restore
36+
run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true
3437

3538
- name: Test
36-
run: dotnet test -c Release --no-build --verbosity normal
39+
run: dotnet test -c Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
3740

38-
- name: Upload the package to this release
39-
run: gh release upload ${{ github.ref_name }} MinimalXmlReader/bin/Release/MinimalXmlReader.*.nupkg
41+
- name: Code Coverage Report
42+
uses: irongut/[email protected]
43+
with:
44+
filename: coverage/**/coverage.cobertura.xml
45+
badge: true
46+
fail_below_min: true
47+
format: text
48+
hide_branch_rate: false
49+
hide_complexity: true
50+
indicators: true
51+
output: both
52+
thresholds: '60 80'
4053

4154
- name: Publish the package to nuget.org
4255
run: dotnet nuget push MinimalXmlReader/bin/Release/MinimalXmlReader.*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
4356

4457
- name: Publish the package to github.com
4558
run: dotnet nuget push MinimalXmlReader/bin/Release/MinimalXmlReader.*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bigbang1112/index.json
59+
60+
- name: Upload the package to this release
61+
run: gh release upload ${{ github.ref_name }} MinimalXmlReader/bin/Release/MinimalXmlReader.*.nupkg
62+
63+
- name: Set release information
64+
run: gh release edit ${{ github.ref_name }} -n "$(echo -e '${{ github.event.release.body }}\n\nAssets were automatically generated using the [publish workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).')"

0 commit comments

Comments
 (0)