-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (72 loc) · 2.3 KB
/
nuget-push.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
85
86
87
88
name: Publish NuGet packages
permissions:
contents: write
packages: write
id-token: write
attestations: write
# Controls when the action will run.
on:
push:
branches:
- main
# - develop
- v*
paths-ignore:
- 'nodsoft_moltenobsidian_web/**'
- 'nodsoft_moltenobsidian_ssg_client/**'
- 'Samples/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-test:
uses: ./.github/workflows/build.yml
publish-nuget:
name: Publish NuGet package
runs-on: ubuntu-latest
needs:
- build-test
strategy:
fail-fast: false
matrix:
# Sources to publish to
nuget: [
{ name: "NuGet", source: "https://api.nuget.org/v3/index.json", keyname: "NUGET_TOKEN" },
{ name: "GitHub Packages", source: "https://nuget.pkg.github.com/Nodsoft", keyname: "GITHUB_TOKEN" }
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Setup NuGet CLI
uses: NuGet/[email protected]
- uses: dotnet/[email protected]
id: nbgv
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Package
run: dotnet pack -c Release --no-build --include-symbols
- id: is-public-release
uses: ASzc/change-string-case-action@v6
with:
string: ${{ steps.nbgv.outputs.PublicRelease }}
- name: Attest build provenance for .(s)nupkgs
uses: actions/attest-build-provenance@v1
# Only once per package: take nuget provider
if: matrix.nuget.name == 'NuGet'
with:
subject-path: "**/Release/*nupkg"
# Publish
- name: Publish packages to ${{ matrix.nuget.name }}
run: |
dotnet nuget push "**/Release/*.nupkg" \
--source "${{ matrix.nuget.source }}" \
--symbol-source "${{ matrix.nuget.source }}" \
--api-key "${{ secrets[matrix.nuget.keyname] }}" \
--symbol-api-key "${{ secrets[matrix.nuget.keyname] }}" \
--skip-duplicate