5
5
pluginName :
6
6
description : Project name detected by parsing build spec file
7
7
value : ${{ jobs.check-event.outputs.pluginName }}
8
+ pluginVersion :
9
+ description : Project version detected by parsing build spec file
10
+ value : ${{ jobs.check-event.outputs.pluginVersion }}
8
11
jobs :
9
12
check-event :
10
13
name : Check GitHub Event Data 🔎
19
22
config : ${{ steps.setup.outputs.config }}
20
23
commitHash : ${{ steps.setup.outputs.commitHash }}
21
24
pluginName : ${{ steps.setup.outputs.pluginName }}
25
+ pluginVersion : ${{ steps.setup.outputs.pluginVersion }}
22
26
steps :
23
27
- uses : actions/checkout@v4
24
28
with :
@@ -62,14 +66,31 @@ jobs:
62
66
done
63
67
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
64
68
65
- plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
66
- plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g' || echo "")"
69
+ plugin_name="$(jq -r '.name' buildspec.json)"
70
+ plugin_display_name="$(jq -r '.displayName // empty' buildspec.json)"
71
+
72
+ # For PR builds, calculate the same development version that CMake uses
73
+ if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
74
+ # Match CMake logic: MAJOR.MINOR.(9000 + GITHUB_RUN_NUMBER)
75
+ base_version="$(jq -r '.version' buildspec.json)"
76
+ IFS='.' read -r major minor patch <<< "${base_version}"
77
+ if [[ -n "${GITHUB_RUN_NUMBER}" ]]; then
78
+ run_mod=$((GITHUB_RUN_NUMBER % 1000)) # Limit to 0-999 range
79
+ dev_patch=$((900 + run_mod)) # Results in 900-1899 range
80
+ plugin_version="${major}.${minor}.${dev_patch}"
81
+ else
82
+ plugin_version="${major}.${minor}.999"
83
+ fi
84
+ else
85
+ plugin_version="$(jq -r '.version' buildspec.json)"
86
+ fi
67
87
68
88
if [[ "${plugin_display_name}" ]]; then
69
89
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
70
90
else
71
91
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
72
92
fi
93
+ echo "pluginVersion=${plugin_version}" >> $GITHUB_OUTPUT
73
94
74
95
macos-build :
75
96
name : Build for macOS 🍏
@@ -105,12 +126,11 @@ jobs:
105
126
print '::endgroup::'
106
127
107
128
local product_name
108
- local product_version
109
- read -r product_name product_version <<< \
110
- "$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
129
+ read -r product_name <<< \
130
+ "$(jq -r '.name' buildspec.json)"
111
131
112
132
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
113
- print "pluginVersion=${product_version }" >> $GITHUB_OUTPUT
133
+ print "pluginVersion=${{ needs.check-event.outputs.pluginVersion } }" >> $GITHUB_OUTPUT
114
134
115
135
- uses : actions/cache/restore@v4
116
136
id : ccache-cache
@@ -155,6 +175,7 @@ jobs:
155
175
notarize : ${{ fromJSON(needs.check-event.outputs.notarize) && fromJSON(steps.codesign.outputs.haveNotarizationUser) }}
156
176
codesignUser : ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
157
177
codesignPass : ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
178
+ version : ${{ needs.check-event.outputs.pluginVersion }}
158
179
159
180
- name : Upload Artifacts 📡
160
181
uses : actions/upload-artifact@v4
@@ -197,11 +218,11 @@ jobs:
197
218
: Set Up Environment 🔧
198
219
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
199
220
200
- read -r product_name product_version <<< \
201
- "$(jq -r '. | { name, version} | join(" ") ' buildspec.json)"
221
+ read -r product_name <<< \
222
+ "$(jq -r '.name' buildspec.json)"
202
223
203
224
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
204
- echo "pluginVersion=${product_version }" >> $GITHUB_OUTPUT
225
+ echo "pluginVersion=${{ needs.check-event.outputs.pluginVersion } }" >> $GITHUB_OUTPUT
205
226
206
227
- uses : actions/cache/restore@v4
207
228
id : ccache-cache
@@ -223,6 +244,7 @@ jobs:
223
244
target : x86_64
224
245
config : ${{ needs.check-event.outputs.config }}
225
246
package : ${{ fromJSON(needs.check-event.outputs.package) }}
247
+ version : ${{ needs.check-event.outputs.pluginVersion }}
226
248
227
249
- name : Upload Source Tarball 🗜️
228
250
uses : actions/upload-artifact@v4
@@ -272,10 +294,9 @@ jobs:
272
294
273
295
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
274
296
$ProductName = $BuildSpec.name
275
- $ProductVersion = $BuildSpec.version
276
297
277
298
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
278
- "pluginVersion=${ProductVersion }" >> $env:GITHUB_OUTPUT
299
+ "pluginVersion=${{ needs.check-event.outputs.pluginVersion } }" >> $env:GITHUB_OUTPUT
279
300
280
301
- name : Build Plugin 🧱
281
302
uses : ./.github/actions/build-plugin
@@ -289,6 +310,7 @@ jobs:
289
310
target : x64
290
311
config : ${{ needs.check-event.outputs.config }}
291
312
package : ${{ fromJSON(needs.check-event.outputs.package) }}
313
+ version : ${{ needs.check-event.outputs.pluginVersion }}
292
314
293
315
- name : Upload Artifacts 📡
294
316
uses : actions/upload-artifact@v4
0 commit comments