Skip to content

Commit efd276c

Browse files
committed
💚 Creates a CI for nuget deployment.
1 parent a7ea60d commit efd276c

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
publish:
10+
name: Publish to NuGet
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '9.x'
21+
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
25+
- name: Build with explicit version
26+
run: |
27+
VERSION=${GITHUB_REF_NAME}
28+
dotnet build \
29+
--configuration Release \
30+
-p:Version=$VERSION \
31+
--no-restore
32+
33+
- name: Pack with symbols
34+
run: |
35+
VERSION=${GITHUB_REF_NAME}
36+
dotnet pack RestSharp.Authenticators.Digest/RestSharp.Authenticators.Digest.csproj \
37+
--configuration Release \
38+
-p:Version=$VERSION \
39+
-p:IncludeSymbols=true \
40+
-p:SymbolPackageFormat=snupkg \
41+
--no-build \
42+
--output ./nupkgs
43+
44+
- name: Publish .nupkg and .snupkg to NuGet.org
45+
run: |
46+
dotnet nuget push ./nupkgs/*.nupkg \
47+
--source https://api.nuget.org/v3/index.json \
48+
--api-key ${{ secrets.NUGET_API_KEY }} \
49+
--skip-duplicate
50+
51+
dotnet nuget push ./nupkgs/*.snupkg \
52+
--source https://api.nuget.org/v3/index.json \
53+
--api-key ${{ secrets.NUGET_API_KEY }} \
54+
--skip-duplicate

RestSharp.Authenticators.Digest.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ EndProject
3030
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{46506451-F83B-4074-9BF7-D05E3CBB7D05}"
3131
ProjectSection(SolutionItems) = preProject
3232
.github\workflows\codeql.yml = .github\workflows\codeql.yml
33+
.github\workflows\nuget-publish.yml = .github\workflows\nuget-publish.yml
3334
EndProjectSection
3435
EndProject
3536
Global

0 commit comments

Comments
 (0)