fix: docker push

This commit is contained in:
Elijah McMorris 2024-06-14 15:10:05 -07:00
parent c2267a4bea
commit 486ed4c958
Signed by: NexVeridian
SSH key fingerprint: SHA256:bsA1SKZxuEcEVHAy3gY1HUeM5ykRJl0U0kQHQn0hMg8
4 changed files with 24 additions and 18 deletions

View file

@ -1,4 +1,4 @@
name: Docker
name: docker
on:
workflow_run:
@ -73,17 +73,16 @@ jobs:
# https://github.com/orgs/community/discussions/25768#discussioncomment-3249183
- name: Downcase REPO
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: ./result
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.REPO }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Strip REPO Username
run: |
STRIP_REPO_USERNAME=$(echo "${{ env.REPO }}" | sed 's/nexveridian\///')
echo "STRIP_REPO_USERNAME=${STRIP_REPO_USERNAME}" >> ${GITHUB_ENV}
# https://github.com/docker/build-push-action/issues/538
- name: Push and tag Docker image
run: |
docker load < result
docker tag ${{ env.STRIP_REPO_USERNAME }}:latest ${{ env.REGISTRY }}/${{ env.REPO }}:latest
docker push ${{ env.REGISTRY }}/${{ env.REPO }}:latest