-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2 KB
/
build-and-push-nuget-packages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
on:
workflow_dispatch:
name: Build & Push NuGet Packages
# run-name:
jobs:
artifact-build:
name: Build - With Artifact
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore project dependencies
run: |
dotnet restore dekoeky.hello-world
- name: Build project
run: |
dotnet build dekoeky.hello-world --no-restore -c Release
- name: Pack project
run: |
dotnet pack dekoeky.hello-world --no-restore -c Release
#Debug:
# - run: ls
# - run: find . -type f \( -name *.nupkg -or -name *.snupkg \)
- name: Store the NuGet artifacts
uses: actions/upload-artifact@v2
with:
name: packages
path: |
dekoeky.hello-world/bin/Release/*.nupkg
dekoeky.hello-world/bin/Release/*.snupkg
upload-nuget-org:
name: Upload to NuGet.org
runs-on: ubuntu-latest
needs: [artifact-build]
environment: NuGet.org
steps:
- uses: actions/download-artifact@v2
with:
name: packages
# - run: ls .
# - run: tree .
- run: |
dotnet nuget push "*.nupkg" \
--skip-duplicate \
-s https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }}
upload-github:
name: Upload to GitHub
runs-on: ubuntu-latest
needs: [artifact-build]
environment: GitHub
permissions:
packages: write
steps:
- uses: actions/download-artifact@v2
with:
name: packages
- run: ls .
- run: tree .
- run: |
dotnet nuget push "*.nupkg" \
--skip-duplicate \
-s https://nuget.pkg.github.com/dekoeky/index.json \
--api-key ${{ secrets.GITHUB_TOKEN }}