-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (61 loc) · 2.33 KB
/
Copy pathbuild.yml
File metadata and controls
74 lines (61 loc) · 2.33 KB
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
name: Build and Restore
on:
push:
branches:
- master
- release/*
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Need full history for GitVersion
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0'
- name: Build
run: dotnet build Yllibed.HttpServer.slnx /p:Configuration=Release
- name: Collect NuGet packages
shell: pwsh
run: |
$OutputDir = "nuget-packages"
New-Item -ItemType Directory -Force -Path $OutputDir
Get-ChildItem -Path . -Recurse -Include *.nupkg,*.snupkg | Copy-Item -Destination $OutputDir
- name: Upload NuGet packages as artifacts
uses: actions/upload-artifact@v4
with:
compression-level: 9
name: nuget-packages
path: nuget-packages/
if-no-files-found: error
- name: Test
run: dotnet test Yllibed.HttpServer.slnx /p:Configuration=Release --no-build
publish:
if: startsWith(github.ref, 'refs/heads/master')
# || startsWith(github.ref, 'refs/heads/release/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./nuget-packages
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'
- name: Push NuGet packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push ./nuget-packages/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
dotnet nuget push ./nuget-packages/*.snupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json