-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.87 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
name: Build and Publish .NET NuGet Packages
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
name: Build and Publish Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] # windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Restore .NET
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack (Linux)
run: |
find . -name "*.csproj" -exec dotnet pack {} --configuration Release --output "nupkgs" \;
shell: bash
if: matrix.os == 'ubuntu-latest'
- name: Pack (Windows)
run: |
Get-ChildItem -Path . -Include *.csproj -Recurse | ForEach-Object {
dotnet pack "$_" --configuration Release --output "nupkgs"
}
shell: pwsh
if: matrix.os == 'windows-latest'
- name: Push NuGet Packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_TOKEN }}
run: |
for pkg in nupkgs/*.nupkg; do
dotnet nuget push "$pkg" --source "https://api.nuget.org/v3/index.json" --api-key $NUGET_API_KEY --skip-duplicate
done
if: matrix.os == 'ubuntu-latest'
shell: bash
- name: Push NuGet Packages (Windows)
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_TOKEN }}
run: |
$packages = Get-ChildItem -Path nupkgs -Filter *.nupkg
foreach ($pkg in $packages) {
dotnet nuget push $pkg.FullName --source "https://api.nuget.org/v3/index.json" --api-key $env:NUGET_API_KEY --skip-duplicate
}
if: matrix.os == 'windows-latest'
shell: pwsh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}
path: nupkgs/