Skip to content

Commit db93dab

Browse files
author
MPCoreDeveloper
committed
ci(NuGet): auto-publish SafeWebCore.JwtBearer on master changes
1 parent a668b39 commit db93dab

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish SafeWebCore.JwtBearer
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'src/SafeWebCore.JwtBearer/**'
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build-test-pack-publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v7
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v6
24+
with:
25+
dotnet-version: '10.0.x'
26+
27+
- name: Restore
28+
run: dotnet restore SafeWebCore.slnx
29+
30+
- name: Build
31+
run: dotnet build SafeWebCore.slnx --configuration Release --no-restore
32+
33+
- name: Test
34+
run: dotnet test SafeWebCore.slnx --configuration Release --no-build
35+
36+
- name: Pack
37+
run: dotnet pack src/SafeWebCore.JwtBearer/SafeWebCore.JwtBearer.csproj --configuration Release --no-build --output artifacts/nuget
38+
39+
- name: Publish to NuGet.org
40+
env:
41+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
42+
run: |
43+
if [ -z "$NUGET_API_KEY" ]; then
44+
echo "::warning::NUGET_API_KEY secret is not set. Skipping NuGet publish."
45+
exit 0
46+
fi
47+
dotnet nuget push "artifacts/nuget/*.nupkg" \
48+
--api-key "$NUGET_API_KEY" \
49+
--source https://api.nuget.org/v3/index.json \
50+
--skip-duplicate

0 commit comments

Comments
 (0)