1
1
name : _buildpacks-release
2
-
3
2
on :
4
3
workflow_call :
5
4
inputs :
45
44
docker_hub_token :
46
45
required : true
47
46
description : The token to login to Docker Hub with
48
-
49
47
defaults :
50
48
run :
51
49
# Setting an explicit bash shell ensures GitHub Actions enables pipefail mode too,
52
50
# ratherthan only error on exit (improving failure UX when pipes are used). See:
53
51
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
54
52
shell : bash
55
-
56
53
env :
57
54
CARGO_TERM_COLOR : always
58
55
PACKAGE_DIR : ./packaged
59
-
60
56
jobs :
61
57
compile :
62
58
name : Compile Buildpacks
@@ -70,19 +66,14 @@ jobs:
70
66
uses : actions/checkout@v4
71
67
with :
72
68
submodules : true
73
-
74
69
- name : Install musl-tools
75
70
run : sudo apt-get install musl-tools --no-install-recommends
76
-
77
71
- name : Update Rust toolchain
78
72
run : rustup update
79
-
80
73
- name : Install Rust linux-musl target
81
74
run : rustup target add x86_64-unknown-linux-musl
82
-
83
75
- name : Rust cache
84
76
85
-
86
77
# the version of `libcnb-cargo` installed here is kept in sync with the version of `libcnb-package`
87
78
# that the release automation CLI tooling depends on
88
79
- name : Install libcnb-cargo
@@ -93,25 +84,20 @@ jobs:
93
84
| yq -ptoml -oyaml '.package[] | select(.name == "libcnb-package") | .version' \
94
85
)
95
86
cargo install --locked "libcnb-cargo@${LIBCNB_PACKAGE_VERSION}"
96
-
97
87
- name : Install Languages CLI
98
- uses : heroku/languages-github-actions/.github/actions/install-languages-cli@main
88
+ uses : heroku/languages-github-actions/.github/actions/install-languages-cli@v0.4.1
99
89
with :
100
90
branch : ${{ inputs.languages_cli_branch }}
101
91
update_rust_toolchain : false
102
-
103
92
- name : Package buildpacks
104
93
id : libcnb-package
105
94
run : cargo libcnb package --release --package-dir ${{ env.PACKAGE_DIR }}
106
-
107
95
- name : Generate buildpack matrix
108
96
id : generate-buildpack-matrix
109
97
run : actions generate-buildpack-matrix --package-dir ${{ env.PACKAGE_DIR }}
110
-
111
98
- name : Generate changelog
112
99
id : generate-changelog
113
100
run : actions generate-changelog --version ${{ steps.generate-buildpack-matrix.outputs.version }}
114
-
115
101
- name : Temporary fix for bash-based buildpacks
116
102
run : |
117
103
buildpacks='${{ steps.generate-buildpack-matrix.outputs.buildpacks }}'
@@ -149,13 +135,11 @@ jobs:
149
135
fi
150
136
done
151
137
done
152
-
153
138
- name : Cache buildpacks
154
139
uses : actions/cache/save@v4
155
140
with :
156
141
key : ${{ github.run_id }}-compiled-buildpacks
157
142
path : ${{ env.PACKAGE_DIR }}
158
-
159
143
publish-docker :
160
144
name : Publish → Docker - ${{ matrix.buildpack_id }}
161
145
needs : [compile]
@@ -173,31 +157,25 @@ jobs:
173
157
path : ${{ env.PACKAGE_DIR }}
174
158
env :
175
159
SEGMENT_DOWNLOAD_TIMEOUT_MINS : 1
176
-
177
160
- name : Install Pack CLI
178
161
uses :
buildpacks/github-actions/[email protected]
179
-
180
162
- name : Create Docker Image
181
163
run : pack buildpack package ${{ matrix.buildpack_id }} --config ${{ matrix.buildpack_output_dir }}/package.toml -v
182
-
183
164
- name : Login to Docker Hub
184
165
if : inputs.dry_run == false
185
166
186
167
with :
187
168
registry : docker.io
188
169
username : ${{ secrets.docker_hub_user }}
189
170
password : ${{ secrets.docker_hub_token }}
190
-
191
171
- name : Check if version is already on Docker Hub
192
172
id : check
193
173
run : echo "published_to_docker=$(docker manifest inspect "${{ matrix.docker_repository }}:${{ matrix.buildpack_version }}" &> /dev/null && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
194
-
195
174
- name : Tag and publish buildpack
196
175
if : inputs.dry_run == false && steps.check.outputs.published_to_docker == 'false'
197
176
run : |
198
177
docker tag ${{ matrix.buildpack_id }} ${{ matrix.docker_repository }}:${{ matrix.buildpack_version }}
199
178
docker push ${{ matrix.docker_repository }}:${{ matrix.buildpack_version }}
200
-
201
179
publish-github :
202
180
name : Publish → GitHub Release
203
181
needs : [compile]
@@ -211,31 +189,26 @@ jobs:
211
189
path : ${{ env.PACKAGE_DIR }}
212
190
env :
213
191
SEGMENT_DOWNLOAD_TIMEOUT_MINS : 1
214
-
215
192
- name : Install Pack CLI
216
193
uses :
buildpacks/github-actions/[email protected]
217
-
218
194
- name : Generate CNB files
219
195
run : |
220
196
for buildpack in $(jq --exit-status -c '.[]' <<< '${{ needs.compile.outputs.buildpacks }}'); do
221
197
artifact_prefix=$(jq --exit-status -r '.buildpack_artifact_prefix' <<< "${buildpack}")
222
198
output_dir=$(jq --exit-status -r '.buildpack_output_dir' <<< "${buildpack}")
223
199
pack buildpack package "${artifact_prefix}.cnb" --config "${output_dir}/package.toml" --format file --verbose
224
200
done
225
-
226
201
- name : Get token for GitHub application (Linguist)
227
202
uses : heroku/use-app-token-action@main
228
203
id : generate-token
229
204
with :
230
205
app_id : ${{ inputs.app_id }}
231
206
private_key : ${{ secrets.app_private_key }}
232
-
233
207
- name : Check if release exists
234
208
id : check
235
209
env :
236
210
GH_TOKEN : ${{ steps.generate-token.outputs.app_token }}
237
211
run : echo "published_to_github=$(gh release view v${{ needs.compile.outputs.version }} -R ${{ github.repository }} &> /dev/null && echo "true" || echo "false")" >> $GITHUB_OUTPUT
238
-
239
212
- name : Create GitHub Release
240
213
if : inputs.dry_run == false && steps.check.outputs.published_to_github == 'false'
241
214
@@ -245,7 +218,6 @@ jobs:
245
218
body : ${{ needs.compile.outputs.changelog }}
246
219
files : " *.cnb"
247
220
fail_on_unmatched_files : true
248
-
249
221
publish-cnb :
250
222
name : Publish → CNB Registry - ${{ matrix.buildpack_id }}
251
223
needs : [compile, publish-docker]
@@ -257,7 +229,6 @@ jobs:
257
229
steps :
258
230
- name : Install crane
259
231
uses :
buildpacks/github-actions/[email protected]
260
-
261
232
- name : Check if version is already in the registry
262
233
id : check
263
234
run : |
@@ -267,11 +238,9 @@ jobs:
267
238
else
268
239
echo "published_to_cnb_registry=false" >> $GITHUB_OUTPUT
269
240
fi
270
-
271
241
- name : Calculate the buildpack image digest
272
242
id : digest
273
243
run : echo "value=$(crane digest ${{ matrix.docker_repository }}:${{ matrix.buildpack_version }})" >> "$GITHUB_OUTPUT"
274
-
275
244
- name : Register the new version with the CNB Buildpack Registry
276
245
if : inputs.dry_run == false && steps.check.outputs.published_to_cnb_registry == 'false'
277
246
uses : docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.5.1
@@ -280,7 +249,6 @@ jobs:
280
249
id : ${{ matrix.buildpack_id }}
281
250
version : ${{ matrix.buildpack_version }}
282
251
address : ${{ matrix.docker_repository }}@${{ steps.digest.outputs.value }}
283
-
284
252
update-builder :
285
253
name : Update Builder
286
254
needs : [compile, publish-docker, publish-cnb, publish-github]
@@ -292,12 +260,10 @@ jobs:
292
260
with :
293
261
app_id : ${{ inputs.app_id }}
294
262
private_key : ${{ secrets.app_private_key }}
295
-
296
263
- name : Checkout
297
264
uses : actions/checkout@v4
298
265
with :
299
266
path : ./buildpacks
300
-
301
267
- name : Checkout cnb-builder-images repository
302
268
uses : actions/checkout@v4
303
269
with :
@@ -306,22 +272,18 @@ jobs:
306
272
# Using the GH application token here will configure the local git config for this repo with credentials
307
273
# that can be used to make signed commits that are attributed to the GH application user
308
274
token : ${{ steps.generate-token.outputs.app_token }}
309
-
310
275
- name : Install crane
311
276
uses :
buildpacks/github-actions/[email protected]
312
-
313
277
- name : Install Languages CLI
314
- uses : heroku/languages-github-actions/.github/actions/install-languages-cli@main
278
+ uses : heroku/languages-github-actions/.github/actions/install-languages-cli@v0.4.1
315
279
with :
316
280
branch : ${{ inputs.languages_cli_branch }}
317
-
318
281
- name : Update Builder
319
282
# The dry run check is performed here because the update process requires a published
320
283
# image to exist in order to calculate a digest with `crane`. Adding the check here
321
284
# means no files will be modified and so no PR will be created later.
322
285
if : inputs.dry_run == false
323
286
run : actions update-builder --repository-path ./buildpacks --builder-repository-path ./cnb-builder-images --builders builder-20,builder-22,builder-classic-22,buildpacks-20,salesforce-functions
324
-
325
287
- name : Create Pull Request
326
288
id : pr
327
289
uses :
peter-evans/[email protected]
@@ -339,7 +301,6 @@ jobs:
339
301
# This will ensure commits made from this workflow are attributed to the GH application user
340
302
committer : ${{ inputs.app_username }} <${{ inputs.app_email }}>
341
303
author : ${{ inputs.app_username }} <${{ inputs.app_email }}>
342
-
343
304
- name : Configure PR
344
305
if : steps.pr.outputs.pull-request-operation == 'created'
345
306
run : gh pr merge --auto --squash --repo heroku/cnb-builder-images "${{ steps.pr.outputs.pull-request-number }}"
0 commit comments