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