-
Notifications
You must be signed in to change notification settings - Fork 99
107 lines (89 loc) · 4.1 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- name: Setup .NET
uses: actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # tag: v4.2.0
with:
dotnet-version: |
8.0.405
9.0.102
- name: Check for NuGet packages cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag: v4.2.0
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/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-windows-2022
path: bin/ci-artifacts/bin-windows-2022
- name: Download Ubuntu x64 Artifacts from build job
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-ubuntu-20.04
path: bin/ci-artifacts/bin-ubuntu-20.04
- name: Download Ubuntu arm64 Artifacts from build job
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-otel-linux-arm64
path: bin/ci-artifacts/bin-otel-linux-arm64
- name: Download Alpine x64 Artifacts from build job
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-alpine-x64
path: bin/ci-artifacts/bin-alpine-x64
- name: Download Alpine arm64 Artifacts from build job
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-alpine-arm64
path: bin/ci-artifacts/bin-alpine-arm64
- name: Download Mac-OS Artifacts from build job
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # tag: v4.1.8
with:
name: bin-macos-13
path: bin/ci-artifacts/bin-macos-13
- 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.17
- 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/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # tag: v4.6.0
with:
name: bin-nuget-packages
path: bin/nuget-artifacts/