Skip to content

Commit

Permalink
More visibility into expected tags
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroCC committed Oct 25, 2024
1 parent a4c182a commit ffdc180
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,23 @@ jobs:
- name: Sanitize some things
id: prepare
run: |
# Sanitize the registry name
REGISTRY="${{ matrix.registry }}"
REGISTRY="${REGISTRY^^}" # upper case
REGISTRY="${REGISTRY//[^A-Z0-9]/_}" # replace non-alphanumeric with _
echo "REGISTRY=${REGISTRY}" >> $GITHUB_OUTPUT
# Sanitize org and repo names
ORG="${{ github.organization }}"
if [[ ${{ matrix.registry }} != "ghcr.io" ]]; then
# Quay & DockerHub don't support dashes in the repository name
ORG="${ORG//\-/}" # Remove dashes from the repository name
fi
REPO="${ORG}/${{ github.repository_name }}"
REPO="${REPO,,}" # lowercase
# Quay & DockerHub don't support dashes in the repository name
UNSANITIZED_ORG="${{ github.organization }}"
REPO="${UNSANITIZED_ORG//\-/}/${{ github.repository_name }}" # Remove dashes from the repository name
echo "REPOSITORY=${{ matrix.registry }}/${REPO}" | tee -a $GITHUB_OUTPUT
# Sanitize the registry name for use by secrets
REGISTRY="${{ matrix.registry }}"
REGISTRY="${REGISTRY//[^A-Za-z0-9]/_}" # replace non-alphanumeric with _
echo "REGISTRY=${REGISTRY}" | tee -a $GITHUB_OUTPUT
- name: Prepare Credentials
id: credentials
run: |
Expand Down Expand Up @@ -228,9 +234,14 @@ jobs:
id: check
if: steps.credentials.outputs.REGISTRY_READY == 'true'
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
BASE_TAGS=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
GUI_TAGS=$(jq -cr '.tags | map("-t " + .) | join("-gui ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
echo "Base Tags: ${BASE_TAGS}"
echo "GUI Tags: ${GUI_TAGS}"
docker buildx imagetools create $BASE_TAGS \
${{ env.REGISTRY_IMAGE }}@${{ needs.build-minrobot.outputs.digest }}
# Cheap way to also copy the gui
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join("-gui ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
docker buildx imagetools create $GUI_TAGS \
${{ env.REGISTRY_IMAGE }}@${{ needs.build-gui.outputs.digest }}

0 comments on commit ffdc180

Please sign in to comment.