From b915ed7dd2b069f1c70202361b68d11f1f8b61ea Mon Sep 17 00:00:00 2001 From: Haozhe Zhang Date: Sun, 12 Jul 2026 23:50:01 -0700 Subject: [PATCH] Slugify the branch name used as the docker image tag The Build Docker job tags the image with the branch name, so any branch with a slash in it fails the build: ERROR: failed to build: invalid tag "ghcr.io/cadquery/cadquery-docker:fix/assembly-load-segfault": invalid reference Replace the slashes for the tag. On master the tag is unchanged, so the published image keeps its name. --- .github/workflows/apptainer_build.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/apptainer_build.yml b/.github/workflows/apptainer_build.yml index 6ed2b4bf5..db6ca42d7 100644 --- a/.github/workflows/apptainer_build.yml +++ b/.github/workflows/apptainer_build.yml @@ -56,16 +56,21 @@ jobs: - name: Check out code for the container builds uses: actions/checkout@v6 + - name: Set the image tag + run: | + # a docker tag cannot contain a slash, which branch names often do + echo "IMAGE_TAG=${BRANCH_NAME//\//-}" >> "$GITHUB_ENV" + - name: Build Container run: | - docker build -t ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} -f images/dockerfile . + docker build -t ghcr.io/cadquery/cadquery-docker:${IMAGE_TAG} -f images/dockerfile . - name: Test run: | - docker run --rm -v $(pwd):/host -w /host ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} pytest tests/ + docker run --rm -v $(pwd):/host -w /host ghcr.io/cadquery/cadquery-docker:${IMAGE_TAG} pytest tests/ - name: Deploy to GHCR if: contains(env.BRANCH_NAME, 'master') run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin - docker push ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + docker push ghcr.io/cadquery/cadquery-docker:${IMAGE_TAG}