1- name : Build Project
1+ name : Build
22
33env :
4- BUILD_PATH : " ${{github.workspace}}/packages"
5- BUILD_VERSION : " 5.0.${{github.run_number}}"
6- BUILD_INFORMATION : " 5.0.${{github.run_number}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}"
4+ DOTNET_NOLOGO : true
5+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
6+ BUILD_PATH : ' ${{github.workspace}}/artifacts'
7+ COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
78
89on :
910 push :
@@ -22,48 +23,82 @@ jobs:
2223 runs-on : ubuntu-latest
2324
2425 steps :
25- - name : Checkout
26- uses : actions/checkout@v3
27- with :
28- fetch-depth : 0
29-
30- - name : Setup .NET
31- uses : actions/setup-dotnet@v3
32- with :
33- dotnet-version : 7.0.x
34-
35- - name : Restore Dependencies
36- run : dotnet restore
37-
38- - name : Build Project
39- run : ' dotnet build --configuration Release --no-restore -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_INFORMATION}}"'
40-
41- - name : Run Tests
42- run : ' dotnet test --configuration Release --no-build --no-restore --collect:"XPlat Code Coverage"'
43-
44- - name : Create Packages
45- run : ' dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore -p:Version="${{env.BUILD_VERSION}}" --output "${{env.BUILD_PATH}}"'
46-
47- - name : Upload Package Artifact
48- if : success()
49- uses : actions/upload-artifact@v3
50- with :
51- name : Packages
52- path : " ${{env.BUILD_PATH}}"
53-
54- - name : Publish Packages
55- if : success() && github.event_name != 'pull_request'
56- run : |
57- dotnet nuget add source --username pwelter34 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/loresoft/index.json"
58- for package in $(find -name "*.nupkg"); do
59- echo "${0##*/}": Pushing $package...
60- dotnet nuget push $package --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
61- done
62-
63- - name : Publish Release Packages
64- if : success() && startsWith(github.ref, 'refs/tags/v')
65- run : |
66- for package in $(find -name "*.nupkg"); do
67- echo "${0##*/}": Pushing $package...
68- dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
69- done
26+ - name : Checkout
27+ uses : actions/checkout@v3
28+ with :
29+ fetch-depth : 0
30+
31+ - name : Install .NET Core
32+ uses : actions/setup-dotnet@v3
33+ with :
34+ dotnet-version : |
35+ 6.0.x
36+ 7.0.x
37+
38+ - name : Restore Dependencies
39+ run : dotnet restore
40+
41+ - name : Build Solution
42+ run : dotnet build --no-restore --configuration Release
43+
44+ - name : Run Test
45+ run : dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
46+
47+ - name : Generate Coverage
48+ uses :
danielpalme/[email protected] 49+ with :
50+ reports : ' ${{github.workspace}}/test/*/TestResults/*/coverage.info'
51+ targetdir : ${{env.BUILD_PATH}}
52+ reporttypes : lcov
53+
54+ - name : Report Coverage
55+ if : success()
56+ uses : coverallsapp/github-action@v2
57+ with :
58+ file : artifacts/lcov.info
59+ format : lcov
60+
61+ - name : Create Packages
62+ if : success() && github.event_name != 'pull_request'
63+ run : dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}"
64+
65+ - name : Upload Packages
66+ if : success() && github.event_name != 'pull_request'
67+ uses : actions/upload-artifact@v3
68+ with :
69+ name : packages
70+ path : ' ${{env.BUILD_PATH}}'
71+
72+ deploy :
73+ runs-on : ubuntu-latest
74+ needs : build
75+ if : success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
76+
77+ steps :
78+ - name : Download Artifact
79+ uses : actions/download-artifact@v3
80+ with :
81+ name : packages
82+
83+ - name : Publish Packages GitHub
84+ run : |
85+ for package in $(find -name "*.nupkg"); do
86+ echo "${0##*/}": Pushing $package...
87+ dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
88+ done
89+
90+ - name : Publish Packages feedz
91+ run : |
92+ for package in $(find -name "*.nupkg"); do
93+ echo "${0##*/}": Pushing $package...
94+ dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
95+ done
96+
97+ - name : Publish Packages Nuget
98+ if : startsWith(github.ref, 'refs/tags/v')
99+ run : |
100+ for package in $(find -name "*.nupkg"); do
101+ echo "${0##*/}": Pushing $package...
102+ dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
103+ done
104+
0 commit comments