Skip to content

Commit 5983d5c

Browse files
authored
Merge pull request #91 from PandaTechAM/development
updated nugets and docs
2 parents ac03bff + d235ab6 commit 5983d5c

File tree

7 files changed

+1371
-1443
lines changed

7 files changed

+1371
-1443
lines changed

.github/workflows/main.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,73 @@
1-
name: Deploy NuGet Package
1+
name: Publish NuGet Package
22

33
env:
4-
PROJECT_PATH: './src/SharedKernel/SharedKernel.csproj'
5-
OUTPUT_DIR: 'nupkgs'
6-
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
7-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
4+
PROJECT_PATH: src/SharedKernel/SharedKernel.csproj
5+
OUTPUT_DIR: nupkgs
6+
NUGET_SOURCE: https://api.nuget.org/v3/index.json
87

98
on:
109
push:
11-
branches:
12-
- main
10+
branches: [main]
11+
12+
permissions:
13+
contents: read
14+
1315
jobs:
14-
deploy:
16+
publish:
1517
runs-on: ubuntu-latest
1618

1719
steps:
1820
- name: Checkout
1921
uses: actions/checkout@v6
2022

21-
- name: Setup .NET Core
23+
- name: Setup .NET
2224
uses: actions/setup-dotnet@v5
2325
with:
2426
global-json-file: global.json
2527

28+
- name: Restore
29+
run: dotnet restore ${{ env.PROJECT_PATH }}
30+
2631
- name: Build
27-
run: dotnet build ${{ env.PROJECT_PATH }}
32+
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
33+
34+
# - name: Test
35+
# run: dotnet test --no-build --configuration Release --verbosity normal
2836

2937
- name: Pack
30-
run: dotnet pack ${{ env.PROJECT_PATH }} --output ${{ env.OUTPUT_DIR }}
38+
run: dotnet pack ${{ env.PROJECT_PATH }} --no-build --configuration Release --output ${{ env.OUTPUT_DIR }}
3139

3240
- name: Publish
33-
run: dotnet nuget push ${{ env.OUTPUT_DIR }}/*.nupkg -k ${{ env.NUGET_API_KEY }} -s ${{ env.NUGET_SOURCE }}
41+
env:
42+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
47+
if [ -z "${NUGET_API_KEY:-}" ]; then
48+
echo "NUGET_API_KEY secret is not set."
49+
exit 1
50+
fi
51+
52+
shopt -s nullglob
53+
54+
nupkgs=( "${{ env.OUTPUT_DIR }}"/*.nupkg )
55+
snupkgs=( "${{ env.OUTPUT_DIR }}"/*.snupkg )
56+
57+
if [ ${#nupkgs[@]} -eq 0 ]; then
58+
echo "No .nupkg files found in ${{ env.OUTPUT_DIR }}"
59+
ls -la "${{ env.OUTPUT_DIR }}" || true
60+
exit 1
61+
fi
62+
63+
dotnet nuget push "${nupkgs[@]}" \
64+
--api-key "$NUGET_API_KEY" \
65+
--source "${{ env.NUGET_SOURCE }}" \
66+
--skip-duplicate
67+
68+
if [ ${#snupkgs[@]} -gt 0 ]; then
69+
dotnet nuget push "${snupkgs[@]}" \
70+
--api-key "$NUGET_API_KEY" \
71+
--source "${{ env.NUGET_SOURCE }}" \
72+
--skip-duplicate
73+
fi

0 commit comments

Comments
 (0)