Skip to content

Commit 96c1622

Browse files
committed
Add cd-production.yml
1 parent e76fec6 commit 96c1622

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish NuGet package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json
9+
BUILD_CONFIGURATION: "Release"
10+
DOTNET_VERSION: "8.x"
11+
12+
jobs:
13+
build-pack-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: ${{ env.DOTNET_VERSION }}
23+
source-url: ${{ env.ARTIFACTS_FEED_URL }}
24+
env:
25+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}
26+
27+
- name: Determine version for NuGet package
28+
run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV
29+
30+
- name: Build and pack
31+
run: |
32+
dotnet restore
33+
dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} -p:Version=$NUGET_VERSION
34+
dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore --no-build -p:PackageVersion=$NUGET_VERSION
35+
36+
- name: Push NuGet package
37+
run: echo "dotnet nuget push -k $NUGET_AUTH_TOKEN **/bin/Release/*.nupkg"
38+
env:
39+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- run: dotnet build -c Release
4848

49-
- run: dotnet pack -c Release --no-build --no-restore -o ./artifacts /p:PackageVersion=$(date -d "${GITHUB_RUN_TIMESTAMP}" "+%Y.%-m.%-d")-ci.${{ github.run_attempt }}${{ github.run_id }}
49+
- run: dotnet pack -c Release --no-build --no-restore -o ./artifacts -p:PackageVersion=$(date -d "${GITHUB_RUN_TIMESTAMP}" "+%Y.%-m.%-d")-ci.${{ github.run_attempt }}${{ github.run_id }}
5050

5151
- name: Upload artifact
5252
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)