@@ -13,21 +13,52 @@ jobs:
1313 uses : ./.github/workflows/build.yml
1414 secrets : inherit
1515
16+ pack :
17+ name : Create NuGet packages
18+ needs : [build]
19+ runs-on : ubuntu-24.04
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
25+ - name : Set Dev version
26+ if : github.ref == 'refs/heads/main'
27+ run : |
28+ version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')"
29+ if [ -z "${version}" ]; then
30+ version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)"
31+ fi
32+ echo "VERSION=${version}" >> $GITHUB_ENV
33+
34+ - name : Set Release version
35+ if : startsWith(github.ref, 'refs/tags/v')
36+ run : echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
37+
38+ - name : Pack artifacts
39+ run : dotnet pack -p:PackageVersion="${{ env.VERSION }}" -o packages
40+
41+ - name : Upload artifacts
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : packages
45+ path : packages/*nupkg
46+
1647 github :
1748 name : Deploy to GitHub
18- needs : [build ]
49+ needs : [pack ]
1950 runs-on : ubuntu-24.04
2051 steps :
2152 - name : Download artifacts
2253 uses : actions/download-artifact@v4
2354 with :
24- name : nupkgs
55+ name : packages
2556 - name : Push to pkg.github.com
26- run : dotnet nuget push "**/* .nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate
57+ run : dotnet nuget push "*.nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate
2758
28- nuget :
29- name : Deploy to NuGet
30- needs : [build ]
59+ release :
60+ name : Create GitHub release
61+ needs : [pack ]
3162 if : startsWith(github.ref, 'refs/tags/v')
3263 runs-on : ubuntu-24.04
3364 steps :
@@ -36,10 +67,22 @@ jobs:
3667 - name : Download artifacts
3768 uses : actions/download-artifact@v4
3869 with :
39- name : nupkgs
70+ name : packages
71+ path : packages
4072 - name : Create GitHub Release
41- run : gh release create ${{ github.ref_name }} ** /*nupkg
73+ run : gh release create ${{ github.ref_name }} packages /*nupkg
4274 env :
4375 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76+
77+ nuget :
78+ name : Deploy to NuGet
79+ needs : [release]
80+ if : startsWith(github.ref, 'refs/tags/v')
81+ runs-on : ubuntu-24.04
82+ steps :
83+ - name : Download artifacts
84+ uses : actions/download-artifact@v4
85+ with :
86+ name : packages
4487 - name : Push to nuget.org
45- run : dotnet nuget push "**/* .nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}
88+ run : dotnet nuget push "*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}
0 commit comments