@@ -12,16 +12,26 @@ jobs:
1212
1313 steps :
1414
15- - name : install .NET Core 10 SDKs
15+ - name : install .NET Core 10 SDK
1616 uses : actions/setup-dotnet@v2
1717 with :
1818 include-prerelease : false
1919 dotnet-version : |
2020 10.0.x
2121
22+ - name : .NET info
23+ run : dotnet --info
24+ shell : pwsh
25+
2226 - name : checkout repository
2327 uses : actions/checkout@v2
2428
29+ - name : set version
30+ run : |
31+ . ./.github/workflows/ci.ps1
32+ Set-VersionSuffixOnTag "$Env:GITHUB_WORKSPACE/src" "$Env:GITHUB_REF"
33+ shell : pwsh
34+
2535 - name : dotnet restore
2636 run : dotnet restore
2737
3848 with :
3949 check_name : tests results
4050 trx_files : " **/test-results/**/*.trx"
51+
52+ - name : test results badge color
53+ shell : bash
54+ run : |
55+ case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
56+ success)
57+ echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
58+ ;;
59+ failure)
60+ echo "BADGE_COLOR=800000" >> $GITHUB_ENV
61+ ;;
62+ neutral)
63+ echo "BADGE_COLOR=696969" >> $GITHUB_ENV
64+ ;;
65+ esac
66+
67+ - name : create test result badge
68+ uses : emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1
69+ with :
70+ label : tests
71+ status : ' ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
72+ color : ${{ env.BADGE_COLOR }}
73+ path : badge.svg
74+
75+ - name : Upload badge to Gist
76+ if : >
77+ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'master' ||
78+ github.event_name != 'workflow_run' && github.ref == 'refs/heads/master'
79+ uses : andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
80+ with :
81+ token : ${{ secrets.GIST_TOKEN }}
82+ gistURL : https://gist.github.com/PawelGerr/2311eb236eb4a66e7c422005bd498060
83+ file : badge.svg
84+
85+ - name : pack
86+ run : dotnet pack --configuration Release --no-build --output out
87+
88+ - uses : actions/upload-artifact@v4
89+ with :
90+ name : nuget-packages
91+ path : |
92+ out/*.nupkg
93+ out/*.snupkg
94+ if-no-files-found : ' error'
95+
96+ - name : push to nuget.org
97+ if : startsWith(github.ref, 'refs/tags/')
98+ run : |
99+ cd out
100+ dotnet nuget push "*.nupkg" -k "$env:API_KEY" --skip-duplicate
101+ shell : pwsh
102+ env :
103+ API_KEY : ${{ secrets.NUGET_ORG_API_KEY }}
0 commit comments