From cc0eae5a194d5c0c33d1d4546fdcf5384b7e24a2 Mon Sep 17 00:00:00 2001 From: Naoyuki Sogo Date: Tue, 22 Sep 2026 23:56:13 +0900 Subject: [PATCH] ci: backport release-type labeling from main (aicshud/WHEEL branch-strategy work) Bring maintenance2023's build_and_deploy.yml in line with main's release labeling scheme (see RIKEN-RCCS/OPEN-WHEEL#145): each release type gets a distinct title prefix (release/maintenance/beta - unreachable "release" and "beta" cases kept only for parity with main's copy, since this branch's own name always resolves to TYPE=maintenance), and maintenance releases are real (non-prerelease) releases that never take the "Latest" badge - previously every non-master build was marked prerelease regardless of type. Also carries over SAFE_BRANCH_NAME (BRANCH_NAME with "/" stripped) for consistency with main's copy, even though this branch's own name has no slash to strip. Trigger (workflow_dispatch only) is unchanged. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01C3jKNM1qubomM8UTRdkEWu --- .github/workflows/build_and_deploy.yml | 40 +++++++++++++++++--------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 290b7529..f4dbf56f 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -12,42 +12,53 @@ jobs: steps: - uses: actions/checkout@v4 - uses: eWaterCycle/setup-apptainer@v2 - - name: determine version number for this build + - name: determine version number and release type for this build # This value is baked into the image via the WHEEL_VERSION build-arg (see # the docker build step) and into source.tar.gz below. It is never # committed back: master is branch-protected, and the per-branch # `[skip ci] update version number` commits used to conflict on # server/app/db/version.json between parallel PRs (issue #1014). + # + # SAFE_BRANCH_NAME strips "/" from BRANCH_NAME, matching main's + # build_and_deploy.yml - harmless here (this branch's name has no + # slash) but keeps this file consistent if it is ever synced forward. run: | case "${BRANCH_NAME}" in master) TYPE=release ;; maintenance*) TYPE=maintenance ;; *) TYPE=beta ;; esac + case "${TYPE}" in + release) TITLE_PREFIX="โœ… Release" ;; + maintenance) TITLE_PREFIX="๐Ÿ”ง Maintenance" ;; + beta) TITLE_PREFIX="๐Ÿงช Beta" ;; + esac + echo "SAFE_BRANCH_NAME=$(echo "${BRANCH_NAME}" | tr '/' '-')" >>$GITHUB_ENV echo "VERSION_NUMBER=$(date '+%Y-%m%d-%H%M%S')-${TYPE}" >>$GITHUB_ENV # only master builds (TYPE=release) own the `latest` docker tag and the # GitHub "Latest" release; maintenance*/beta builds must not. echo "RELEASE_TYPE=${TYPE}" >>$GITHUB_ENV - - run: docker build --build-arg WHEEL_VERSION="${VERSION_NUMBER}" -t ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${BRANCH_NAME} . + echo "TITLE_PREFIX=${TITLE_PREFIX}" >>$GITHUB_ENV + - run: docker build --build-arg WHEEL_VERSION="${VERSION_NUMBER}" -t ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${SAFE_BRANCH_NAME} . - run: docker login -u ${DOCKER_USER_NAME} -p ${DOCKER_PASSWORD} - - run: docker push ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${BRANCH_NAME} + - run: docker push ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${SAFE_BRANCH_NAME} - name: publish :latest for mainline releases only if: env.RELEASE_TYPE == 'release' run: | - docker tag ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${BRANCH_NAME} \ + docker tag ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${SAFE_BRANCH_NAME} \ ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:latest docker push ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:latest - - run: docker save ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${BRANCH_NAME} | gzip > wheel_docker.tar.gz - - run: apptainer build wheel.sif docker-daemon://${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${BRANCH_NAME} + - run: docker save ${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${SAFE_BRANCH_NAME} | gzip > wheel_docker.tar.gz + - run: apptainer build wheel.sif docker-daemon://${DOCKER_USER_NAME}/${DOCKER_CONTAINER_NAME}:${SAFE_BRANCH_NAME} - name: pack source.tar.gz with the version baked in # git archive would ship the committed placeholder version.json; extract # the tracked tree, drop in the real version, and re-pack so a run from # source.tar.gz reports the same version as the images (issue #1014). run: | rm -rf _src && mkdir -p _src - git archive --prefix=OpenWHEEL-${BRANCH_NAME}/ HEAD | tar -x -C _src - echo "{\"version\": \"${VERSION_NUMBER}\" }" > _src/OpenWHEEL-${BRANCH_NAME}/server/app/db/version.json - tar -czf source.tar.gz -C _src OpenWHEEL-${BRANCH_NAME} + git archive --prefix=OpenWHEEL-${SAFE_BRANCH_NAME}/ HEAD | tar -x -C _src + echo "{\"version\": \"${VERSION_NUMBER}\" }" > _src/OpenWHEEL-${SAFE_BRANCH_NAME}/server/app/db/version.json + tar -czf source.tar.gz -C _src OpenWHEEL-${SAFE_BRANCH_NAME} rm -rf _src - name: create release and upload artifact uses: softprops/action-gh-release@v2 @@ -57,13 +68,14 @@ jobs: wheel_docker.tar.gz source.tar.gz tag_name: ${{ env.VERSION_NUMBER }} - name: ${{ env.VERSION_NUMBER }} + name: "${{ env.TITLE_PREFIX }} ${{ env.VERSION_NUMBER }}" body: "release for ${{ github.ref_name }} @ ${{ github.sha }} (${{ env.VERSION_NUMBER }})" - # only the master line is the "Latest" release; maintenance*/beta ship - # as pre-releases so they never take the badge or the /releases/latest - # redirect (v1 silently ignored these inputs). + # only the master line ever takes the "Latest" badge and the + # /releases/latest redirect (v1 silently ignored these inputs). + # maintenance backports are real, non-draft releases (not "pre"), they + # just never become "Latest" - only beta is marked prerelease. make_latest: ${{ env.RELEASE_TYPE == 'release' }} - prerelease: ${{ env.RELEASE_TYPE != 'release' }} + prerelease: ${{ env.RELEASE_TYPE == 'beta' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} backup: