-
Notifications
You must be signed in to change notification settings - Fork 93
93 lines (77 loc) · 3.15 KB
/
build-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
85
86
87
88
89
90
91
92
93
name: Build NuGet Packages
on:
workflow_call:
outputs:
# Output the NuGet version suffix so that the caller workflow can have the correct package version.
nuget-version-suffix:
description: "The NuGet version suffix to build the packages"
value: ${{ jobs.build-nuget-packages.outputs.nuget-version-suffix }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/packages
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build-nuget-packages:
# In principle this job "needs: [ build, build-container ]", however, that would cause the build and build-container
# jobs to run twice, which is not what we want. Instead, we let the "caller" job handle the dependencies.
outputs:
nuget-version-suffix: ${{ steps.set-nuget-version-suffix.outputs.suffix }}
runs-on: windows-2022
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- uses: actions/[email protected]
with:
dotnet-version: |
6.0.414
7.0.401
- name: Check for NuGet packages cache
uses: actions/[email protected]
id: nuget-cache
with:
key: ${{ hashFiles('**/Directory.packages.props', './build/LibraryVersions.g.cs', '**/packages.config' ) }}
path: ${{ env.NUGET_PACKAGES }}
- name: Download Windows Artifacts from build job
uses: actions/[email protected]
with:
name: bin-windows-2022
path: bin/ci-artifacts/bin-windows-2022
- name: Download CentOS Artifacts from build job
uses: actions/[email protected]
with:
name: bin-centos
path: bin/ci-artifacts/bin-centos
- name: Download Alpine Artifacts from build job
uses: actions/[email protected]
with:
name: bin-alpine
path: bin/ci-artifacts/bin-alpine
- name: Download Mac-OS Artifacts from build job
uses: actions/[email protected]
with:
name: bin-macos-11
path: bin/ci-artifacts/bin-macos-11
- name: Build NuGet packages
run: ./build.cmd BuildNuGetPackages
- name: Install dotnet-validate
run: dotnet tool install --global dotnet-validate --version 0.0.1-preview.304
- name: Install Meziantou.Framework.NuGetPackageValidation.Tool
run: dotnet tool install --global Meziantou.Framework.NuGetPackageValidation.Tool --version 1.0.12
- name: Validate nuget packages
shell: pwsh
run: |
foreach ($file in (Get-ChildItem bin/nuget-artifacts//*.nupkg)) {
dotnet validate package local $($file)
if (-not ($LASTEXITCODE -eq 0)) {
throw "dotnet validate failed for $($file)";
}
meziantou.validate-nuget-package $($file)
if (-not ($LASTEXITCODE -eq 0)) {
throw "meziantou.validate-nuget-package validate failed for $($file)";
}
}
- name: Upload Nuget Artifacts
uses: actions/[email protected]
with:
name: bin-nuget-packages
path: bin/nuget-artifacts/