From 099ba475de7681be676ba6f2ccfdd91842e55c4e Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 4 Aug 2023 16:37:24 +0200 Subject: [PATCH] Use branch name as default tag for images This commit sets the branch name as the default tag for the produced image. It also adds again quay.io (in addition to ghcr.io) as destination for the images. --- .github/workflows/main.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b94524..db08a0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,9 @@ name: Create kpa-marp-pandoc container image env: - REGISTRY_NAME: ghcr.io - CONTAINER_NAME: mmul-it/kpa-marp-pandoc - CONTAINER_VERSION: latest + REGISTRY_GHCR: ghcr.io/mmul-it + REGISTRY_QUAY: quay.io/mmul + CONTAINER_NAME: kpa-marp-pandoc on: [push] @@ -13,8 +13,17 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the container image - run: docker build . --file Dockerfile --tag ${REGISTRY_NAME}/${CONTAINER_NAME}:${CONTAINER_VERSION} - - name: Login into the container registry - run: echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ vars.GHCR_USER }} --password-stdin - - name: Push the image into the container registry - run: docker push ${REGISTRY_NAME}/${CONTAINER_NAME}:${CONTAINER_VERSION} + run: docker build . + --file Dockerfile + --tag ${REGISTRY_GHCR}/${CONTAINER_NAME}:${{ github.ref_name }} + --tag ${REGISTRY_GHCR}/${CONTAINER_NAME}:latest + --tag ${REGISTRY_QUAY}/${CONTAINER_NAME}:${{ github.ref_name }} + --tag ${REGISTRY_QUAY}/${CONTAINER_NAME}:latest + - name: Login into the GitHub Container Registry + run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ${REGISTRY_GHCR} --username "${{ vars.GHCR_USER }}" --password-stdin + - name: Login into the Quay Container Registry + run: echo "${{ secrets.QUAY_ROBOT_TOKEN }}" | docker login ${REGISTRY_QUAY} --username "${{ vars.QUAY_ROBOT_NAME }}" --password-stdin + - name: Push the image into the GitHub Container Registry + run: docker push --all-tags ${REGISTRY_GHCR}/${CONTAINER_NAME} + - name: Push the image into the Quay Container Registry + run: docker push --all-tags ${REGISTRY_QUAY}/${CONTAINER_NAME}