From f6053c42c3da3dfe5c6b5e7e1712f11d6a4e6935 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 20 Dec 2023 16:58:57 +0200 Subject: [PATCH] Push docker image to ghcr --- .github/workflows/deploy.yaml | 37 +++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 138d3d7..eb78931 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -6,6 +6,8 @@ on: env: GO_VERSION: "1.21" CI_REGISTRY_IMAGE: "${{ secrets.CI_REGISTRY }}/registration-relay" + GHCR_REGISTRY: ghcr.io + GHCR_REGISTRY_IMAGE: "ghcr.io/${{ github.repository }}" jobs: lint: @@ -30,18 +32,32 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: docker/setup-buildx-action@v2 - - uses: docker/login-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Beeper Docker registry + uses: docker/login-action@v2 with: registry: ${{ secrets.CI_REGISTRY }} username: ${{ secrets.CI_REGISTRY_USER }} password: ${{ secrets.CI_REGISTRY_PASSWORD }} + + - name: Login to ghcr + uses: docker/login-action@v2 + with: + registry: ${{ env.GHCR_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v2 with: context: . cache-from: ${{ env.CI_REGISTRY_IMAGE }}:latest pull: true - tags: ${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }} + tags: | + ${{ env.CI_REGISTRY_IMAGE }}:${{ github.sha }} + ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} push: true deploy-docker: @@ -50,11 +66,24 @@ jobs: needs: - build-docker steps: - - uses: docker/login-action@v2 + - name: Login to Beeper Docker registry + uses: docker/login-action@v2 with: registry: ${{ secrets.CI_REGISTRY }} username: ${{ secrets.CI_REGISTRY_USER }} password: ${{ secrets.CI_REGISTRY_PASSWORD }} + + - name: Login to ghcr + uses: docker/login-action@v2 + with: + registry: ${{ env.GHCR_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: beeper/docker-retag-push-latest@main with: image: ${{ env.CI_REGISTRY_IMAGE }} + + - uses: beeper/docker-retag-push-latest@main + with: + image: ${{ env.GHCR_REGISTRY_IMAGE }}