From 4e7c37ee07c8d1f636baad26046f5755db8e1c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Fritze?= Date: Tue, 19 Apr 2022 09:38:33 +0200 Subject: [PATCH] [ci] rewire docker image metadata this should now also work if the repo name isn't all lowercase --- .github/workflows/ci.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cd75fe..be1561e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,10 @@ name: CI on: push: +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: maven: runs-on: ubuntu-latest @@ -38,9 +42,15 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + # https://github.com/docker/metadata-action (lower cases image name, etc.) + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push uses: docker/build-push-action@v2 with: - push: true - tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} \ No newline at end of file + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}