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.
This commit is contained in:
Finlay Davidson 2022-06-16 09:32:16 +02:00 committed by JF
parent 4ee3e51605
commit 6a0aec0850

View File

@ -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