Skip to content

Commit

Permalink
Attempt 5
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyknox committed Nov 9, 2023
1 parent a9047f6 commit dc7c0b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,27 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set lowercase image name
run: echo "LOWERCASE_IMAGE_NAME=${{ github.repository }} | tr 'A-Z' 'a-z'" >> $GITHUB_ENV

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}

- name: Finalize Docker Metadata
id: docker_tagging
run: |
if [[ "${{ github.event_name }}" == 'schedule' ]]; then
echo "cron trigger, assigning nightly tag"
echo "docker_tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "docker_tags=${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}:nightly,${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}:nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
elif [[ "${GITHUB_REF##*/}" == "main" ]] || [[ ${GITHUB_REF##*/} == "master" ]]; then
echo "manual trigger from master/main branch, assigning latest tag"
echo "docker_tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_OUTPUT
echo "docker_tags=${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}:${GITHUB_REF##*/},${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}:latest" >> $GITHUB_OUTPUT
else
echo "Neither scheduled nor manual release from main branch. Just tagging as branch name"
echo "docker_tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
echo "docker_tags=${{ env.REGISTRY }}/${{ env.LOWERCASE_IMAGE_NAME }}:${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
fi
- name: Inspect Docker Metadata
Expand Down

0 comments on commit dc7c0b7

Please sign in to comment.