From c2c3dcff6f6ffbc4e1662418865d9590a6af4941 Mon Sep 17 00:00:00 2001 From: Tristan Date: Sat, 11 Jan 2025 17:22:15 +0000 Subject: [PATCH] Try to avoid multiple sources of truth for docker registry pushed to --- .github/workflows/ci.yml | 4 +++- .github/workflows/publish.yml | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38481dc..bc044c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: echo "build_version=$BUILD_VERSION" | tee -a "$GITHUB_OUTPUT" JAVA_VERSION="$(echo "${{ env.JAVA_VERSION }}" | grep -E "^[0-9]+$")" echo "java_version=$JAVA_VERSION" | tee -a "$GITHUB_OUTPUT" - DOCKER_IMAGE="$(echo "${{ env.DOCKER_REGISTRY }}/$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')" + DOCKER_IMAGE="$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')" echo "docker_image=$DOCKER_IMAGE" | tee -a "$GITHUB_OUTPUT" build_hotspot: @@ -73,6 +73,7 @@ jobs: with: JAVA_VERSION: "${{ needs.set_variables.outputs.java_version }}" ARTIFACT_NAME: "mcw.jar" + DOCKER_REGISTRY: "ghcr.io" DOCKER_IMAGE: "${{ needs.set_variables.outputs.docker_image }}" DOCKER_TARGET: "hotspot" DOCKER_TAG_CANONICAL: "${{ needs.set_variables.outputs.build_version }}-hotspot" @@ -114,6 +115,7 @@ jobs: with: JAVA_VERSION: "${{ needs.set_variables.outputs.java_version }}" ARTIFACT_NAME: "mcw-bin" + DOCKER_REGISTRY: "ghcr.io" DOCKER_IMAGE: "${{ needs.set_variables.outputs.docker_image }}" DOCKER_TARGET: "graal" DOCKER_TAG_CANONICAL: "${{ needs.set_variables.outputs.build_version }}-hotspot" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 63de3d8..0708df3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,9 @@ on: ARTIFACT_NAME: type: string required: true + DOCKER_REGISTRY: + type: string + required: true DOCKER_IMAGE: type: string required: true @@ -26,7 +29,6 @@ concurrency: env: DOCKER_LAYER_CACHE: "/tmp/.buildx-cache" - DOCKER_REGISTRY: "ghcr.io" jobs: docker: @@ -56,14 +58,14 @@ jobs: - name: "Log in to the Container registry" uses: "docker/login-action@v3" with: - registry: "${{ env.DOCKER_REGISTRY }}" + registry: "${{ inputs.DOCKER_REGISTRY }}" username: "${{ github.actor }}" password: "${{ secrets.GITHUB_TOKEN }}" - name: "Extract metadata (tags, labels) for Docker" id: "meta" uses: "docker/metadata-action@v5" with: - images: "${{ inputs.DOCKER_IMAGE }}" + images: "${{ inputs.DOCKER_REGISTRY }}/${{ inputs.DOCKER_IMAGE }}" tags: | type=raw,event=push,enable=true,value=${{ inputs.DOCKER_TAG_CANONICAL }} type=raw,event=push,enable={{ is_default_branch }},value=${{ inputs.DOCKER_TAG_SHORT }}