|
39 | 39 | fallback: none |
40 | 40 | - id: check |
41 | 41 | run: | |
| 42 | + set +x |
42 | 43 | IFS=$'\n\t' |
43 | 44 | trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR |
44 | 45 | retry() { |
@@ -222,6 +223,7 @@ jobs: |
222 | 223 | - name: Create and push release commit and tag |
223 | 224 | id: push |
224 | 225 | run: | |
| 226 | + set +x |
225 | 227 | IFS=$'\n\t' |
226 | 228 | trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR |
227 | 229 | retry() { |
@@ -329,90 +331,84 @@ jobs: |
329 | 331 | git tag -f "${major_version_tag}" |
330 | 332 | refs=("refs/heads/releases/${major_version_tag}" "+refs/tags/${major_version_tag}") |
331 | 333 |
|
332 | | - if [[ "${INSTALL_ACTION}" == 'true' ]]; then |
333 | | - tools=() |
334 | | - for tool in tools/codegen/base/*.json; do |
335 | | - tool="${tool##*/}" |
336 | | - tools+=("${tool%.*}") |
337 | | - done |
338 | | - # Aliases. |
339 | | - # NB: Update case for aliases in main.sh, tool input option in test-alias job |
340 | | - # in .github/workflows/ci.yml, and match for alias for tools/codegen/src/tools-markdown.rs. |
341 | | - tools+=( |
342 | | - nextest |
343 | | - taplo-cli |
344 | | - typos-cli |
345 | | - wasm-bindgen-cli |
346 | | - wasmtime-cli |
347 | | - ) |
348 | | - # Non-manifest-based tools. |
349 | | - tools+=(valgrind) |
350 | | -
|
351 | | - branches=() |
352 | | - for tool in "${tools[@]}"; do |
353 | | - git checkout -b "releases/${tool}" |
354 | | - sed -E "${in_place[@]}" action.yml \ |
355 | | - -e "s/required: true/required: false/g" \ |
356 | | - -e "s/# default: #publish:tool/default: ${tool}/g" |
357 | | - git add action.yml |
358 | | - git commit -m "${tool}" |
359 | | - git tag -f "${tool}" |
360 | | - git checkout main |
361 | | - refs+=("+refs/heads/releases/${tool}" "+refs/tags/${tool}") |
362 | | - branches+=("releases/${tool}") |
363 | | - done |
364 | | - fi |
| 334 | + tools=() |
| 335 | + for tool in tools/codegen/base/*.json; do |
| 336 | + tool="${tool##*/}" |
| 337 | + tools+=("${tool%.*}") |
| 338 | + done |
| 339 | + # Aliases. |
| 340 | + # NB: Update case for aliases in main.sh, tool input option in test-alias job |
| 341 | + # in .github/workflows/ci.yml, and match for alias for tools/codegen/src/tools-markdown.rs. |
| 342 | + tools+=( |
| 343 | + nextest |
| 344 | + taplo-cli |
| 345 | + typos-cli |
| 346 | + wasm-bindgen-cli |
| 347 | + wasmtime-cli |
| 348 | + ) |
| 349 | + # Non-manifest-based tools. |
| 350 | + tools+=(valgrind) |
| 351 | +
|
| 352 | + branches=() |
| 353 | + for tool in "${tools[@]}"; do |
| 354 | + git checkout -b "releases/${tool}" |
| 355 | + sed -E "${in_place[@]}" action.yml \ |
| 356 | + -e "s/required: true/required: false/g" \ |
| 357 | + -e "s/# default: #publish:tool/default: ${tool}/g" |
| 358 | + git add action.yml |
| 359 | + git commit -m "${tool}" |
| 360 | + git tag -f "${tool}" |
| 361 | + git checkout main |
| 362 | + refs+=("+refs/heads/releases/${tool}" "+refs/tags/${tool}") |
| 363 | + branches+=("releases/${tool}") |
| 364 | + done |
365 | 365 |
|
366 | 366 | retry git push origin --atomic "${refs[@]}" |
367 | 367 | git branch -d "releases/${major_version_tag}" |
| 368 | + git branch -D "${branches[@]}" |
| 369 | +
|
| 370 | + schema_workspace=/tmp/workspace |
| 371 | + rm -rf -- "${schema_workspace}" |
| 372 | + # Checkout manifest-schema branch |
| 373 | + schema_version="$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "install-action-manifest-schema") | .version')" |
| 374 | + if [[ "${schema_version}" == "0."* ]]; then |
| 375 | + schema_version="0.$(cut -d. -f2 <<<"${schema_version}")" |
| 376 | + else |
| 377 | + schema_version="$(cut -d. -f1 <<<"${schema_version}")" |
| 378 | + fi |
| 379 | + schema_branch="manifest-schema-${schema_version}" |
| 380 | +
|
| 381 | + git worktree add --force "${schema_workspace}" |
| 382 | + ( |
| 383 | + cd -- "${schema_workspace}" |
| 384 | + if git fetch origin "${schema_branch}"; then |
| 385 | + git checkout "origin/${schema_branch}" -B "${schema_branch}" |
| 386 | + elif ! git checkout "${schema_branch}"; then |
| 387 | + # New branch with no history. Credit: https://stackoverflow.com/a/13969482 |
| 388 | + git checkout --orphan "${schema_branch}" |
| 389 | + git rm -rf -- . || true |
| 390 | + git commit -m 'Initial commit' --allow-empty |
| 391 | + fi |
| 392 | + ) |
368 | 393 |
|
369 | | - if [[ "${INSTALL_ACTION}" == 'true' ]]; then |
370 | | - git branch -D "${branches[@]}" |
| 394 | + # Copy over schema |
| 395 | + cp -- ./manifests/* "${schema_workspace}" |
371 | 396 |
|
372 | | - schema_workspace=/tmp/workspace |
373 | | - rm -rf -- "${schema_workspace}" |
374 | | - # Checkout manifest-schema branch |
375 | | - schema_version="$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "install-action-manifest-schema") | .version')" |
376 | | - if [[ "${schema_version}" == "0."* ]]; then |
377 | | - schema_version="0.$(cut -d. -f2 <<<"${schema_version}")" |
378 | | - else |
379 | | - schema_version="$(cut -d. -f1 <<<"${schema_version}")" |
| 397 | + ( |
| 398 | + cd -- "${schema_workspace}" |
| 399 | + # Stage changes |
| 400 | + git add . |
| 401 | + # Detect changes, then commit and push if changes exist |
| 402 | + if [[ "$(git status --porcelain=v1 | LC_ALL=C wc -l)" != "0" ]]; then |
| 403 | + git commit -m 'Update manifest schema' |
| 404 | + retry git push origin HEAD |
380 | 405 | fi |
381 | | - schema_branch="manifest-schema-${schema_version}" |
382 | | -
|
383 | | - git worktree add --force "${schema_workspace}" |
384 | | - ( |
385 | | - cd -- "${schema_workspace}" |
386 | | - if git fetch origin "${schema_branch}"; then |
387 | | - git checkout "origin/${schema_branch}" -B "${schema_branch}" |
388 | | - elif ! git checkout "${schema_branch}"; then |
389 | | - # New branch with no history. Credit: https://stackoverflow.com/a/13969482 |
390 | | - git checkout --orphan "${schema_branch}" |
391 | | - git rm -rf -- . || true |
392 | | - git commit -m 'Initial commit' --allow-empty |
393 | | - fi |
394 | | - ) |
395 | | -
|
396 | | - # Copy over schema |
397 | | - cp -- ./manifests/* "${schema_workspace}" |
398 | | -
|
399 | | - ( |
400 | | - cd -- "${schema_workspace}" |
401 | | - # Stage changes |
402 | | - git add . |
403 | | - # Detect changes, then commit and push if changes exist |
404 | | - if [[ "$(git status --porcelain=v1 | LC_ALL=C wc -l)" != "0" ]]; then |
405 | | - git commit -m 'Update manifest schema' |
406 | | - retry git push origin HEAD |
407 | | - fi |
408 | | - ) |
409 | | -
|
410 | | - rm -rf -- "${schema_workspace}" |
411 | | - git worktree prune |
412 | | - # TODO: get branch in schema_workspace dir instead |
413 | | - git branch -D "${schema_branch}" "${schema_workspace##*/}" |
| 406 | + ) |
414 | 407 |
|
415 | | - fi |
| 408 | + rm -rf -- "${schema_workspace}" |
| 409 | + git worktree prune |
| 410 | + # TODO: get branch in schema_workspace dir instead |
| 411 | + git branch -D "${schema_branch}" "${schema_workspace##*/}" |
416 | 412 | ) |
417 | 413 | env: |
418 | 414 | VERSION: ${{ needs.prepare.outputs.version }} |
|
0 commit comments