Skip to content

Commit

Permalink
Try to avoid multiple sources of truth for docker registry pushed to
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan971 committed Jan 11, 2025
1 parent 95ce84f commit c2c3dcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
ARTIFACT_NAME:
type: string
required: true
DOCKER_REGISTRY:
type: string
required: true
DOCKER_IMAGE:
type: string
required: true
Expand All @@ -26,7 +29,6 @@ concurrency:

env:
DOCKER_LAYER_CACHE: "/tmp/.buildx-cache"
DOCKER_REGISTRY: "ghcr.io"

jobs:
docker:
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit c2c3dcf

Please sign in to comment.