-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (128 loc) · 5.21 KB
/
Copy pathrelease.yml
File metadata and controls
142 lines (128 loc) · 5.21 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Release
# Builds the full LadybugDB package family (managed binding + per-RID native packages + native
# meta-package) via the Cake Frosting pipeline in cake/, and publishes it to nuget.org through
# trusted publishing (OIDC).
#
# Native engine libraries are NOT built here; the pipeline downloads prebuilt `liblbug-*` release
# assets from the upstream engine repo (LadybugDB/ladybug). The engine release defaults to the first
# three numeric segments of the package version (the git tag, or version.txt for manual runs).
#
# Triggers:
# - push a tag like `v0.1.0` -> build, test, pack, and PUBLISH all packages to nuget.org
# - manual `workflow_dispatch` -> build, test, and pack only (artifact uploaded; no publish)
#
# One-time setup required before publishing (see MAINTAINING.md):
# - nuget.org trusted publishing policy owned by the LadybugDB organization (the policy applies to
# all packages owned by that organization)
# (owner=LadybugDB, repo=ladybug-dotnet, workflow file=release.yml; environment left blank for now)
# - repository secret NUGET_USER = your nuget.org profile name (not email)
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Package version to build (defaults to version.txt). Not published on manual runs.'
required: false
default: ''
engine_version:
description: "LadybugDB/ladybug release tag to pull prebuilt native libs from (defaults to the package version's first three numeric segments)."
required: false
default: ''
permissions:
contents: read
jobs:
# Stage prebuilt natives for every RID, gate on the linux-x64 suite against the real engine, then
# pack and validate the whole package family.
pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Determine version
id: ver
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF_NAME#v}" # the tag is the authoritative release version
elif [[ -n "${{ inputs.version }}" ]]; then
VERSION="${{ inputs.version }}"
else
VERSION="$(tr -d '[:space:]' < version.txt)" # single source of truth at the binding root
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Resolved package version: $VERSION"
- name: Resolve engine version
id: engine
shell: bash
run: |
set -euo pipefail
VERSION="${{ steps.ver.outputs.version }}"
ENGINE="${{ inputs.engine_version }}"
BASE="${VERSION%%[-+]*}"
IFS='.' read -r MAJOR MINOR PATCH _ <<< "$BASE"
if [[ ! "${MAJOR:-}" =~ ^[0-9]+$ || ! "${MINOR:-}" =~ ^[0-9]+$ || ! "${PATCH:-}" =~ ^[0-9]+$ ]]; then
echo "Package version '$VERSION' must start with three numeric engine segments." >&2
exit 1
fi
ENGINE="${ENGINE:-v${MAJOR}.${MINOR}.${PATCH}}"
echo "engine=$ENGINE" >> "$GITHUB_OUTPUT"
echo "Pulling native libs from LadybugDB/ladybug release: $ENGINE"
- name: Test gate (linux-x64 against the real engine)
env:
GH_TOKEN: ${{ github.token }}
run: >
dotnet run --project cake/LadybugDB.Build.csproj --
--target Test
--engine-version "${{ steps.engine.outputs.engine }}"
- name: Pack + verify the full package family
env:
GH_TOKEN: ${{ github.token }}
run: >
dotnet run --project cake/LadybugDB.Build.csproj --
--target Pack
--package-version "${{ steps.ver.outputs.version }}"
--engine-version "${{ steps.engine.outputs.engine }}"
- uses: actions/upload-artifact@v7
with:
name: nuget-packages
path: |
artifacts/*.nupkg
artifacts/*.snupkg
if-no-files-found: error
# Publish every package to nuget.org with trusted publishing. Only runs for v* tags.
publish:
needs: pack
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# No GitHub environment for now: the nuget.org trusted-publishing policy is environment-blank.
# Add one back (and set the policy's Environment to match) when we split release vs test.
permissions:
id-token: write # required for the OIDC token used by NuGet/login
contents: read
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Download packed artifacts
uses: actions/download-artifact@v8
with:
name: nuget-packages
path: artifacts
- name: NuGet login (OIDC trusted publishing)
id: login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }} # nuget.org profile name, NOT email
- name: Push to nuget.org
run: >
dotnet nuget push "artifacts/*.nupkg"
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate