Skip to content

Commit f27ae75

Browse files
committed
Add release step
1 parent 2a0666a commit f27ae75

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/dotnet.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ on:
55
branches: [ "main" ]
66
pull_request:
77
branches: [ "main" ]
8+
release:
9+
types: [ "created" ]
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
12-
1314
steps:
1415
- uses: actions/checkout@v4
1516
- name: Setup .NET
@@ -22,3 +23,22 @@ jobs:
2223
run: dotnet build --no-restore
2324
- name: Test
2425
run: dotnet test --no-restore --no-build --verbosity normal
26+
27+
release:
28+
needs: build
29+
runs-on: ubuntu-latest
30+
if: github.event_name == 'release' && github.event.action == 'created'
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: 8.x
37+
- name: Restore dependencies
38+
run: dotnet restore
39+
- name: Pack NuGet package
40+
run: dotnet pack --no-restore -c Release -o ./artifacts
41+
- name: Publish to NuGet
42+
env:
43+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
44+
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY

0 commit comments

Comments
 (0)