From 63301efb28ca16394f4fd5bd0f9258949f0784ef Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Tue, 1 Feb 2022 18:02:59 -0700 Subject: [PATCH] Push images to ghcr.io Alternative container registries like ghcr.io are a good option for anyone seeking to avoid things like docker hub's latest changes to rate limiting --- .github/workflows/buildx.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index a0475e8..7cd2767 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -24,10 +24,17 @@ jobs: uses: crazy-max/ghaction-docker-buildx@v1 with: version: latest - - name: log in to docker hub - run: | - echo "${{ secrets.DOCKER_PASSWORD }}" | \ - docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: build and push the image if: startsWith(github.ref, 'refs/heads/main') && github.actor == 'benbusby' run: | @@ -36,6 +43,9 @@ jobs: docker buildx build --push \ --tag benbusby/whoogle-search:latest \ --platform linux/amd64,linux/arm/v7,linux/arm64 . + docker buildx build --push \ + --tag ghcr.io/benbusby/whoogle-search:latest \ + --platform linux/amd64,linux/arm/v7,linux/arm64 . - name: build and push tag if: startsWith(github.ref, 'refs/tags') run: | @@ -44,3 +54,6 @@ jobs: docker buildx build --push \ --tag benbusby/whoogle-search:${GITHUB_REF#refs/*/v}\ --platform linux/amd64,linux/arm/v7,linux/arm64 . + docker buildx build --push \ + --tag ghcr.io/benbusby/whoogle-search:${GITHUB_REF#refs/*/v}\ + --platform linux/amd64,linux/arm/v7,linux/arm64 .