-
Notifications
You must be signed in to change notification settings - Fork 8
160 lines (147 loc) · 5.85 KB
/
Copy pathgithub-release.yml
File metadata and controls
160 lines (147 loc) · 5.85 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: GitHub Release
on:
workflow_dispatch:
inputs:
version:
description: 'release version'
required: true
default: '2026.1.0'
llvm_run_id:
description: 'llvm workflow run id'
default: "latest"
required: true
llvm_core_libs_run_id:
description: 'llvm core libs workflow run id'
default: "latest"
required: true
halide_run_id:
description: 'halide workflow run id'
default: "latest"
required: true
cctools_run_id:
description: 'cctools workflow run id'
default: "latest"
required: true
clang_apple_cross_run_id:
description: 'clang-apple-cross workflow run id'
default: "latest"
required: true
dry-run:
description: 'dry run (skip release)'
required: true
type: boolean
default: true
draft-release:
description: 'Create draft release'
required: true
type: boolean
default: false
jobs:
publish:
name: Publish packages
runs-on: ubuntu-latest
steps:
- name: Download llvm
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$Workflow = "LLVM prebuilt"
$Repository = $Env:GITHUB_REPOSITORY
$RunId = '${{ github.event.inputs.llvm_run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -R $Repository -w $Workflow --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
Write-Host "Downloading run $RunId ($Workflow)"
& gh run download -R $Repository $RunId
- name: Download llvm core libs
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$Workflow = "LLVM core libs"
$Repository = $Env:GITHUB_REPOSITORY
$RunId = '${{ github.event.inputs.llvm_core_libs_run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -R $Repository -w $Workflow --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
Write-Host "Downloading run $RunId ($Workflow)"
& gh run download -R $Repository $RunId
- name: Download halide
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$Workflow = "halide prebuilt"
$Repository = $Env:GITHUB_REPOSITORY
$RunId = '${{ github.event.inputs.halide_run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -R $Repository -w $Workflow --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
Write-Host "Downloading run $RunId ($Workflow)"
& gh run download -R $Repository $RunId
- name: Download cctools
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$Workflow = "cctools prebuilt"
$Repository = $Env:GITHUB_REPOSITORY
$RunId = '${{ github.event.inputs.cctools_run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -R $Repository -w $Workflow --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
Write-Host "Downloading run $RunId ($Workflow)"
& gh run download -R $Repository $RunId
- name: Download clang-apple-cross
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$Workflow = "clang-apple-cross"
$Repository = $Env:GITHUB_REPOSITORY
$RunId = '${{ github.event.inputs.clang_apple_cross_run_id }}'
if ($RunId -eq 'latest') {
$RunId = $(gh run list -R $Repository -w $Workflow --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
Write-Host "Downloading run $RunId ($Workflow)"
& gh run download -R $Repository $RunId
- name: Create GitHub Release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
if: ${{ github.event.inputs.dry-run == 'false' }}
run: |
$RootDir = Get-Location
Get-ChildItem *.tar.xz -Depth 2 | % { Move-Item $_.FullName $RootDir -Force }
Get-ChildItem . -Directory -Recurse | % { if (-Not (Test-Path ($_.FullName + "\*"))) { Remove-Item $_ } }
$HashPath = 'checksums'
$Version = '${{ github.event.inputs.version }}'
$DraftRelease = [System.Convert]::ToBoolean('${{ github.event.inputs.draft-release }}')
$Files = Get-Item * | % { Get-FileHash -Algorithm SHA256 $_.FullName }
$Files | % { "$($_.Hash) $(Split-Path $_.Path -Leaf)" } | Out-File -FilePath $HashPath -Append -Encoding ASCII
echo "::group::checksums"
Get-Content $HashPath
echo "::endgroup::"
$ReleaseTag = "v${Version}"
$Repository = $Env:GITHUB_REPOSITORY
$ReleaseTitle = "v${Version}"
$Params = @(
$ReleaseTag,
'--repo', $Repository,
'--title', $ReleaseTitle
)
if ($DraftRelease) {
$Params += @('--draft')
}
& gh release create $Params ./*