From 5f19a51a9bd3534fe9a52ebf456958081ac0b15a Mon Sep 17 00:00:00 2001 From: BennyThink Date: Sun, 26 Dec 2021 18:49:47 +0800 Subject: [PATCH] push to ghcr --- .github/workflows/builder.yaml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index d91f5e4..e8b78fc 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -1,3 +1,4 @@ +name: docker image builder on: push: branches: @@ -32,19 +33,35 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Lower case - id: string + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Lower case for Docker Hub + id: dh_string uses: ASzc/change-string-case-action@v1 with: string: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + - name: Lower case for ghcr + id: ghcr_string + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.event.repository.full_name }} + - name: Build and push uses: docker/build-push-action@v2 with: context: . platforms: linux/arm,linux/amd64,linux/arm64 push: true - tags: ${{ steps.string.outputs.lowercase }} + tags: | + ${{ steps.dh_string.outputs.lowercase }} + ghcr.io/${{ steps.ghcr_string.outputs.lowercase }} + cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max