@@ -4,7 +4,7 @@ name: CI for meson build
4
4
on :
5
5
push :
6
6
branches : [ develop, master, release/*, feature/*, hotfix/* ]
7
- tags : [ v* ]
7
+ tags : [ v*, test-ci* ]
8
8
pull_request :
9
9
branches : [ develop ]
10
10
@@ -223,7 +223,35 @@ jobs:
223
223
if : startsWith(matrix.config.name, 'Windows Clang')
224
224
run : |
225
225
$headers = @{ Authorization = 'Bearer ${{ secrets.GITHUB_TOKEN }}' }
226
- echo "LLVM_RELID=$((Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest').Content | ConvertFrom-Json | Select-Object -ExpandProperty id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
226
+ $latestRelease = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases/latest'
227
+ $releaseData = $latestRelease.Content | ConvertFrom-Json
228
+ $assets = $releaseData.assets | Where-Object { $_.name -like "*win64.exe" }
229
+
230
+ if ($assets) {
231
+ $downloadUrl = $assets.browser_download_url
232
+ echo "LLVM_RELID=$($releaseData.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
233
+ echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
234
+ } else {
235
+ Write-Host "No current Windows build available for the latest release. Searching for previous releases..."
236
+ $releases = Invoke-WebRequest -Headers $headers 'https://api.github.com/repos/llvm/llvm-project/releases'
237
+ $found = $false
238
+
239
+ foreach ($release in $releases.Content | ConvertFrom-Json) {
240
+ $assets = $release.assets | Where-Object { $_.name -like "*win64.exe" }
241
+ if ($assets) {
242
+ $downloadUrl = $assets.browser_download_url
243
+ echo "LLVM_RELID=$($release.id)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
244
+ echo "LLVM_DOWNLOAD_URL=$downloadUrl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
245
+ $found = $true
246
+ break
247
+ }
248
+ }
249
+
250
+ if (-not $found) {
251
+ Write-Host "No Windows build available for any recent releases."
252
+ exit 0
253
+ }
254
+ }
227
255
228
256
- name : Restore LLVM from cache
229
257
if : startsWith(matrix.config.name, 'Windows Clang')
@@ -260,14 +288,6 @@ jobs:
260
288
meson setup build -Dprefix=/ -Dmandir=/man -Dbindir=/ ${{ matrix.config.meson_opts }} --buildtype=release
261
289
meson install -C build
262
290
263
- - name : Packing release
264
- env :
265
- ARCHIVE_EXT : ${{ matrix.config.release_extension }}
266
- run : |
267
- cd build
268
- ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
269
- shell : bash
270
-
271
291
# add `GOBIN` to the `PATH` otherwise nfpm in next step can't be found
272
292
- uses : actions/setup-go@v5
273
293
if : ${{ matrix.config.create_package }}
@@ -290,6 +310,26 @@ jobs:
290
310
nfpm package -f ../../nfpm.yaml -p rpm -t ..
291
311
shell : bash
292
312
313
+ - name : Set ownership of executables to root:root
314
+ if : ${{ matrix.config.os != 'windows-latest' }}
315
+ run : sudo chown -R root:root build
316
+
317
+ - name : Packing release
318
+ env :
319
+ ARCHIVE_EXT : ${{ matrix.config.release_extension }}
320
+ run : |
321
+ cd build
322
+ if [[ "${{ matrix.config.os }}" != "windows-latest" ]]; then
323
+ sudo ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
324
+ else
325
+ ${{ matrix.config.archive_command }} "${DESTDIR}${ARCHIVE_EXT}" $DESTDIR
326
+ fi
327
+ shell : bash
328
+
329
+ - name : Set ownership of tar archive to root:root
330
+ if : ${{ matrix.config.os != 'windows-latest' }}
331
+ run : sudo chown root:root build/"${DESTDIR}${ARCHIVE_EXT}"
332
+
293
333
- name : Generate Hashes
294
334
if : ${{ matrix.config.publish_release }}
295
335
shell : bash
@@ -314,7 +354,7 @@ jobs:
314
354
build/*.rpm
315
355
316
356
- name : Publish release
317
- if : ${{ startsWith(github.ref, 'refs/tags/v') && matrix.config.publish_release }}
357
+ if : ${{ ( startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/test-ci') ) && matrix.config.publish_release }}
318
358
uses : softprops/action-gh-release@v2
319
359
with :
320
360
files : |
0 commit comments