From 6a0aec08501bcd1b3abe35ba9db9d6618e5b4b28 Mon Sep 17 00:00:00 2001 From: Finlay Davidson Date: Thu, 16 Jun 2022 09:32:16 +0200 Subject: [PATCH] Use either a secret or infinitime as username Uses either the DOCKER_HUB_USERNAME secret or just infinitime as the username for pushing to and pulling from Docker Hub. --- .github/workflows/docker.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f7aeb7d5..d4669206 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,6 +13,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + USERNAME: infinitime steps: - uses: actions/checkout@v3 @@ -20,7 +22,7 @@ jobs: if: github.event_name == 'push' uses: docker/login-action@v2 with: - username: infinitime + username: ${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Set up QEMU @@ -37,6 +39,6 @@ jobs: platforms: linux/amd64,linux/arm64 builder: ${{ steps.buildx.outputs.name }} push: ${{ github.event_name == 'push' }} - tags: infinitime/infinitime-build:latest - cache-from: type=registry,ref=infinitime/infinitime-build:buildcache - cache-to: type=registry,ref=infinitime/infinitime-build:buildcache,mode=max + tags: ${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:latest + cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache + cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max