|
6 | 6 |
|
7 | 7 | permissions: |
8 | 8 | contents: write # important for release description edit and asset upload |
| 9 | + packages: write |
9 | 10 |
|
10 | 11 | jobs: |
11 | | - build: |
12 | | - name: Build |
| 12 | + build-and-publish: |
| 13 | + name: Build and Publish |
13 | 14 |
|
14 | 15 | runs-on: ubuntu-latest |
15 | 16 |
|
16 | 17 | env: |
17 | 18 | GH_TOKEN: ${{ github.token }} |
18 | 19 |
|
19 | 20 | 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 }}')" |
21 | 25 |
|
22 | 26 | - name: Setup .NET |
23 | | - uses: actions/setup-dotnet@v1 |
| 27 | + uses: actions/setup-dotnet@v4 |
24 | 28 | with: |
25 | 29 | dotnet-version: | |
26 | | - 7.0.x |
27 | | - 6.0.x |
| 30 | + 8.0.x |
28 | 31 | |
29 | 32 | - name: Restore dependencies |
30 | 33 | run: dotnet restore |
31 | 34 |
|
32 | 35 | - name: Build |
33 | | - run: dotnet build -c Release --no-restore |
| 36 | + run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true |
34 | 37 |
|
35 | 38 | - 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 |
37 | 40 |
|
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 | + |
| 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' |
40 | 53 |
|
41 | 54 | - name: Publish the package to nuget.org |
42 | 55 | run: dotnet nuget push MinimalXmlReader/bin/Release/MinimalXmlReader.*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |
43 | 56 |
|
44 | 57 | - name: Publish the package to github.com |
45 | 58 | 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