Docker workflow use separate username for login

This commit is contained in:
Finlay Davidson 2022-07-08 22:48:59 +02:00 committed by JF
parent a9986e5351
commit 358690d08b

View File

@ -13,8 +13,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
USERNAME: infinitime
steps:
- uses: actions/checkout@v3
@ -22,7 +20,7 @@ jobs:
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}
username: ${{ secrets.DOCKER_HUB_LOGIN_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker metadata
@ -30,7 +28,7 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build
${{ secrets.DOCKER_HUB_IMAGE_USERNAME }}/infinitime-build
tags: |
type=sha
type=raw,value=latest
@ -53,8 +51,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME }}/infinitime-build:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME }}/infinitime-build:buildcache,mode=max
- name: Build
if: github.event_name != 'push'
@ -65,4 +63,4 @@ jobs:
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: false
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME }}/infinitime-build:buildcache