@@ -13,21 +13,52 @@ jobs:
13
13
uses : ./.github/workflows/build.yml
14
14
secrets : inherit
15
15
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
+
16
47
github :
17
48
name : Deploy to GitHub
18
- needs : [build ]
49
+ needs : [pack ]
19
50
runs-on : ubuntu-24.04
20
51
steps :
21
52
- name : Download artifacts
22
53
uses : actions/download-artifact@v4
23
54
with :
24
- name : nupkgs
55
+ name : packages
25
56
- 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
27
58
28
- nuget :
29
- name : Deploy to NuGet
30
- needs : [build ]
59
+ release :
60
+ name : Create GitHub release
61
+ needs : [pack ]
31
62
if : startsWith(github.ref, 'refs/tags/v')
32
63
runs-on : ubuntu-24.04
33
64
steps :
@@ -36,10 +67,22 @@ jobs:
36
67
- name : Download artifacts
37
68
uses : actions/download-artifact@v4
38
69
with :
39
- name : nupkgs
70
+ name : packages
71
+ path : packages
40
72
- name : Create GitHub Release
41
- run : gh release create ${{ github.ref_name }} ** /*nupkg
73
+ run : gh release create ${{ github.ref_name }} packages /*nupkg
42
74
env :
43
75
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
44
87
- 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