File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : CI (Build, Test, Alpha Publish )
1+ name : CI (Build and Test )
22
33on :
44 pull_request :
99
1010permissions :
1111 contents : read
12- packages : write
1312
1413jobs :
15- build-test-pack :
14+ build-test :
1615 runs-on : ubuntu-latest
1716 env :
1817 working-directory : ${{ github.workspace }}
5049 - name : Build
5150 run : dotnet build --configuration Release --no-restore
5251 working-directory : ' ${{ env.working-directory }}'
53-
52+
5453 - name : Test
5554 run : dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage"
5655 working-directory : ' ${{ env.working-directory }}'
57-
58- - name : Pack (Pre-release or Alpha)
59- if : ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
60- run : |
61- dotnet pack src/MyLibrary/MyLibrary.csproj \
62- -c Release -o artifacts \
63- /p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersionV2 }}
64-
65- - name : Add GitHub Packages Source
66- if : ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
67- run : |
68- dotnet nuget add source \
69- --username $GITHUB_ACTOR \
70- --password ${{ secrets.GITHUB_TOKEN }} \
71- --store-password-in-clear-text \
72- --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
73-
74- - name : Publish Alpha to GitHub Packages
75- if : ${{ steps.gitversion.outputs.PreReleaseTag != '' && github.ref_type == 'branch' && github.ref != 'refs/heads/main' }}
76- run : dotnet nuget push "artifacts/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate
Original file line number Diff line number Diff line change 99
1010permissions :
1111 contents : write
12- packages : write
1312
1413jobs :
1514 release :
6261 run : dotnet test -c Release --no-build
6362 working-directory : ' ${{ env.working-directory }}'
6463
65- - name : Pack Stable
66- run : |
67- dotnet pack src/MyLibrary/MyLibrary.csproj \
68- -c Release -o artifacts \
69- /p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersionV2 }}
70-
7164 - name : Create Tag (if missing)
7265 run : |
7366 TAG="v${{ steps.gitversion.outputs.MajorMinorPatch }}"
7770 git tag "$TAG"
7871 git push origin "$TAG"
7972 fi
80-
81- - name : Add GitHub Packages Source
82- run : |
83- dotnet nuget add source \
84- --username $GITHUB_ACTOR \
85- --password ${{ secrets.GITHUB_TOKEN }} \
86- --store-password-in-clear-text \
87- --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
88-
89- - name : Publish to GitHub Packages
90- run : dotnet nuget push "artifacts/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate
91-
92- - name : Publish to NuGet
93- if : ${{ startsWith(github.head_ref, 'release/')}}
94- env :
95- NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
96- run : |
97- dotnet nuget push "artifacts/*.nupkg" \
98- --api-key "$NUGET_API_KEY" \
99- --source https://api.nuget.org/v3/index.json \
100- --skip-duplicate
You can’t perform that action at this time.
0 commit comments