Skip to content

Commit e442227

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 343ab4d + 970a5f2 commit e442227

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/nuget.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI/CD NuGet Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
NUGET_SOURCE: https://api.nuget.org/v3/index.json
9+
GITHUB_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
10+
11+
jobs:
12+
build-and-publish:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: 7.0.x
22+
23+
- name: Extract Package Version
24+
id: get_version
25+
run: |
26+
VERSION=${GITHUB_REF#refs/tags/v}
27+
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
28+
echo "Using version: $VERSION"
29+
30+
- name: Restore dependencies
31+
run: dotnet restore
32+
33+
- name: Build
34+
run: dotnet build --no-restore --configuration Release
35+
36+
- name: Test
37+
run: dotnet test --no-build --verbosity normal --configuration Release
38+
39+
- name: Pack
40+
run: dotnet pack --no-build --configuration Release -p:PackageVersion=${{ env.PACKAGE_VERSION }}
41+
42+
- name: Publish to GitHub Packages
43+
run: dotnet nuget push "**/*.nupkg" --source ${{ env.GITHUB_SOURCE }} --api-key ${{ github.token }}
44+
45+
- name: Publish to NuGet
46+
run: dotnet nuget push "**/*.nupkg" --source ${{ env.NUGET_SOURCE }} --api-key ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)