Skip to content

Commit 2d8513c

Browse files
committed
improve ci workflow
1 parent 277cc66 commit 2d8513c

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
with:
3232
fetch-depth: 0
3333

34-
- name: Setup .NET
35-
uses: actions/setup-dotnet@v4
36-
3734
- name: Build
3835
run: dotnet build -c Release
3936

@@ -56,14 +53,14 @@ jobs:
5653

5754
- name: Pack NuGet artifacts
5855
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
59-
run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}"
56+
run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}" -o packages
6057

6158
- name: Upload artifacts
6259
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
6360
uses: actions/upload-artifact@v4
6461
with:
65-
name: nupkgs
66-
path: src/**/*nupkg
62+
name: packages
63+
path: packages/*nupkg
6764

6865
github:
6966
name: Deploy to GitHub
@@ -74,26 +71,44 @@ jobs:
7471
- name: Download artifacts
7572
uses: actions/download-artifact@v4
7673
with:
77-
name: nupkgs
74+
name: packages
7875
- name: Push to GitHub
7976
run: |
80-
dotnet nuget push "**/*.nupkg" \
77+
dotnet nuget push "*.nupkg" \
8178
--skip-duplicate \
8279
-k ${{ secrets.GITHUB_TOKEN }} \
8380
-s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
8481
82+
release:
83+
name: Create GitHub release
84+
needs: [build-windows, build-linux]
85+
if: startsWith(github.ref, 'refs/tags/v')
86+
runs-on: ubuntu-24.04
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@v4
90+
- name: Download artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: packages
94+
path: packages
95+
- name: Create GitHub Release
96+
run: gh release create ${{ github.ref_name }} packages/*nupkg
97+
env:
98+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
85100
nuget:
86101
name: Deploy to NuGet
87-
needs: [build-windows, build-linux]
102+
needs: [release]
88103
if: startsWith(github.ref, 'refs/tags/v')
89104
runs-on: ubuntu-24.04
90105
steps:
91106
- name: Download artifacts
92107
uses: actions/download-artifact@v4
93108
with:
94-
name: nupkgs
109+
name: packages
95110
- name: Push to NuGet
96111
run: |
97-
dotnet nuget push "**/*.nupkg" \
112+
dotnet nuget push "*.nupkg" \
98113
-k ${{ secrets.NUGET_KEY }} \
99114
-s https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)