Skip to content

Commit e31af2f

Browse files
committed
CI: rename artifacts for PRs
1 parent 76d16df commit e31af2f

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/test-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ jobs:
6363
HOST_RELEASE: ${{matrix.host_release}}
6464
EXTRA_CLASSES: ${{matrix.extra_classes}}
6565
ARCH: ${{matrix.arch}}
66+
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
6667

6768
- name: Archive built ISO
6869
if: always()
6970
uses: actions/upload-artifact@v4
7071
with:
71-
name: grml-live-build-result-initial-${{matrix.host_release}}-${{matrix.arch}}${{matrix.extra_classes && format('-{0}', matrix.extra_classes) || ''}}
72+
name: grml-live-build-result-initial-${{github.event.pull_request.number && format('pr{0}-', github.event.pull_request.number) || ''}}${{matrix.host_release}}-${{matrix.arch}}${{matrix.extra_classes && format('-{0}', matrix.extra_classes) || ''}}
7273
if-no-files-found: error
7374
retention-days: 15
7475
path: |
@@ -80,12 +81,13 @@ jobs:
8081
HOST_RELEASE: ${{matrix.host_release}}
8182
EXTRA_CLASSES: ${{matrix.extra_classes}}
8283
ARCH: ${{matrix.arch}}
84+
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
8385

8486
- name: Archive repacked ISO
8587
if: always()
8688
uses: actions/upload-artifact@v4
8789
with:
88-
name: grml-live-build-result-repack-${{matrix.host_release}}-${{matrix.arch}}${{matrix.extra_classes && format('-{0}', matrix.extra_classes) || ''}}
90+
name: grml-live-build-result-repack-${{github.event.pull_request.number && format('pr{0}-', github.event.pull_request.number) || ''}}${{matrix.host_release}}-${{matrix.arch}}${{matrix.extra_classes && format('-{0}', matrix.extra_classes) || ''}}
8991
if-no-files-found: error
9092
retention-days: 15
9193
path: |

build-driver/build.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,15 @@ def main(program_name: str, argv: list[str]) -> int:
435435
elif build_mode == "daily":
436436
old_iso_url = None
437437
CI_PIPELINE_IID = os.getenv("CI_PIPELINE_IID", "0")
438+
GITHUB_PR_NUMBER = os.getenv("GITHUB_PR_NUMBER", "")
438439
date_stamp = job_timestamp.strftime("%Y%m%d")
439-
build_version = f"d{date_stamp}b{CI_PIPELINE_IID}"
440-
build_release_name = f"daily{date_stamp}build{CI_PIPELINE_IID}{debian_suite}"
440+
if GITHUB_PR_NUMBER:
441+
short_date = job_timestamp.strftime("%y%m%d")
442+
build_version = f"pr{GITHUB_PR_NUMBER}d{short_date}"
443+
build_release_name = build_version
444+
else:
445+
build_version = f"d{date_stamp}b{CI_PIPELINE_IID}"
446+
build_release_name = f"daily{date_stamp}build{CI_PIPELINE_IID}{debian_suite}"
441447
artifact_basename = f"grml-{flavor}-{build_release_name}-{arch}"
442448
job_properties = JobProperties(
443449
job_timestamp=job_timestamp,

test/gha-build-iso.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ run_build() {
2626
local results_directory
2727
results_directory=$3
2828

29-
docker run -i --rm --volume "${PWD}:/source" -e SKIP_SOURCES=1 -e DO_DAILY_UPLOAD=0 -e EXTRA_CLASSES="${EXTRA_CLASSES:-}" -w /source debian:"$HOST_RELEASE" \
29+
docker run -i --rm --volume "${PWD}:/source" -e SKIP_SOURCES=1 -e DO_DAILY_UPLOAD=0 -e EXTRA_CLASSES="${EXTRA_CLASSES:-}" -e GITHUB_PR_NUMBER="${GITHUB_PR_NUMBER:-}" -w /source debian:"$HOST_RELEASE" \
3030
bash -c \
3131
"apt-get update -qq && apt-get satisfy -q -y --no-install-recommends 'git, ca-certificates' \
3232
&& git config --global --add safe.directory /source \

0 commit comments

Comments
 (0)