File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish NuGet Package
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ build-and-publish :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ # Checkout the repository
12+ - name : Checkout repository
13+ uses : actions/checkout@v3
14+
15+ # Setup .NET
16+ - name : Setup .NET
17+ uses : actions/setup-dotnet@v3
18+ with :
19+ dotnet-version : ' 8.0.x'
20+
21+ # Restore dependencies
22+ - name : Restore dependencies
23+ run : dotnet restore
24+
25+ # Step to extract the AssemblyVersion from the .csproj file
26+ - name : Extract Package Version
27+ id : get_version
28+ run : |
29+ version=$(grep -oPm1 "(?<=<Version>)[^<]+" $(find . -name "*.csproj"))
30+ echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV
31+ echo "Package Version extracted: $version"
32+
33+ # Build the project
34+ - name : Build the project
35+ run : dotnet build --configuration Release
36+
37+ # Pack the NuGet package
38+ - name : Pack NuGet Package
39+ run : dotnet pack --configuration Release --output ./nupkg
40+
41+ # Publish the package to NuGet
42+ - name : Publish to NuGet
43+ env :
44+ NUGET_KEY : ${{ secrets.NUGET_KEY }}
45+ run : |
46+ dotnet nuget push ./nupkg/*.nupkg \
47+ --api-key $NUGET_KEY \
48+ --source https://api.nuget.org/v3/index.json
You can’t perform that action at this time.
0 commit comments