Skip to content

Commit

Permalink
Handle secrets for PRs docker.yml (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
athackst authored Dec 31, 2024
1 parent 15f4702 commit 0c1313b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
generate:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -235,11 +234,13 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.actor == github.repository_owner
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Log in to GHCR
uses: docker/login-action@v3
if: github.actor == github.repository_owner
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -253,13 +254,15 @@ jobs:
target: ${{ matrix.target }}
platforms: ${{ matrix.platforms }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.label }}:${{ matrix.tag }}-${{ matrix.target }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.label }}:${{ matrix.tag }}-${{ matrix.target }}-${{ steps.date.outputs.date }}
${{ vars.DOCKERHUB_USERNAME }}/${{ matrix.label }}:${{ matrix.tag }}-${{ matrix.target }}
${{ vars.DOCKERHUB_USERNAME }}/${{ matrix.label }}:${{ matrix.tag }}-${{ matrix.target }}-${{ steps.date.outputs.date }}
ghcr.io/${{ github.repository_owner }}/${{ matrix.label }}:${{ matrix.tag }}-${{ matrix.target }}
cache-from: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.label }}:${{ matrix.tag }}-buildcache
type=gha
cache-to: |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.label }}:${{ matrix.tag }}-buildcache,mode=max
type=gha,mode=max
complete:
needs:
Expand Down

0 comments on commit 0c1313b

Please sign in to comment.