Skip to content

Commit 0c6aab3

Browse files
committed
update workflow to auto-publish
1 parent 31fdf99 commit 0c6aab3

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/test.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & test
1+
name: Build, Test, and Deploy
22

33
on: [push]
44

@@ -8,9 +8,28 @@ jobs:
88
steps:
99
- name: Checkout code
1010
uses: actions/checkout@v1
11+
1112
- name: Setup .NET
1213
uses: actions/setup-dotnet@v3
1314
with:
1415
dotnet-version: 8.0.x
16+
17+
- name: Restore dependencies
18+
run: dotnet restore
19+
20+
- name: Build
21+
run: dotnet build --no-restore --configuration Release
22+
1523
- name: Run tests
16-
run: dotnet test test/SimpleBase.Tests.csproj
24+
run: dotnet test --no-build --configuration Release
25+
26+
- name: Pack
27+
run: dotnet pack --no-build --configuration Release --output ./nupkg
28+
29+
- name: Publish to NuGet
30+
if: startsWith(github.ref, 'refs/tags/')
31+
run: dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
32+
33+
- name: Publish to GitHub Packages
34+
if: startsWith(github.ref, 'refs/tags/')
35+
run: dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.GPM_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json

0 commit comments

Comments
 (0)