-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (78 loc) · 3.01 KB
/
publish-nuget.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
89
90
91
92
93
94
95
name: Publish NuGet packages
# Controls when the action will run.
on:
push:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
YumeChan_PluginsLocation: build
jobs:
build-test:
name: Build and Test
strategy:
fail-fast: true
matrix:
# Projects to publish
project: [
{ name: "Base", path: "YumeChan.PluginBase/YumeChan.PluginBase.csproj" },
{ name: "Database.MongoDB", path: "YumeChan.PluginBase.Database.MongoDB/YumeChan.PluginBase.Database.MongoDB.csproj" },
{ name: "Database.Postgres", path: "YumeChan.PluginBase.Database.Postgres/YumeChan.PluginBase.Database.Postgres.csproj" },
]
uses: ./.github/workflows/build.yml
with:
project-path: ${{ matrix.project.path }}
publish-nuget:
name: Publish NuGet package
runs-on: ubuntu-latest
needs:
- build-test
strategy:
fail-fast: false
matrix:
# Projects to publish
project: [
{ name: "Base", path: "YumeChan.PluginBase/YumeChan.PluginBase.csproj" },
{ name: "Database.MongoDB", path: "YumeChan.PluginBase.Database.MongoDB/YumeChan.PluginBase.Database.MongoDB.csproj" },
{ name: "Database.Postgres", path: "YumeChan.PluginBase.Database.Postgres/YumeChan.PluginBase.Database.Postgres.csproj" },
]
# Sources to publish to
nuget: [
{ name: "NuGet", source: "https://api.nuget.org", keyname: "NUGET_TOKEN" },
{ name: "GitHub Packages", source: "https://nuget.pkg.github.com/YumeChan", 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@v3
with:
dotnet-version: 8.0
- name: Setup NuGet CLI
uses: NuGet/setup-nuget@v2
- uses: dotnet/[email protected]
id: nbgv
- name: Restore dependencies
run: dotnet restore ${{ matrix.project.path }}
- name: Build
run: dotnet build -c release ${{ matrix.project.path }}
- name: Package
run: dotnet pack -c Release --no-build --include-symbols ${{ matrix.project.path }}
- 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: "${{ env.YumeChan_PluginsLocation }}/**/*.nupkg"
#subject-path: "**/Release/*nupkg"
# Publish
- name: Publish packages to ${{ matrix.nuget.name }}
run: |
dotnet nuget push "${{ env.YumeChan_PluginsLocation }}/**/*.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