Skip to content

Commit b2370ad

Browse files
committed
Add GHCR credential fallback for image publish
1 parent f2a9c5f commit b2370ad

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ jobs:
219219
uses: docker/login-action@v4
220220
with:
221221
registry: ghcr.io
222-
username: ${{ github.actor }}
223-
password: ${{ secrets.GITHUB_TOKEN }}
222+
username: ${{ secrets.GHCR_USERNAME != '' && secrets.GHCR_USERNAME || github.actor }}
223+
password: ${{ secrets.GHCR_TOKEN != '' && secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }}
224224

225225
- name: Build and push main image
226226
uses: docker/build-push-action@v6
@@ -295,8 +295,8 @@ jobs:
295295
uses: docker/login-action@v4
296296
with:
297297
registry: ghcr.io
298-
username: ${{ github.actor }}
299-
password: ${{ secrets.GITHUB_TOKEN }}
298+
username: ${{ secrets.GHCR_USERNAME != '' && secrets.GHCR_USERNAME || github.actor }}
299+
password: ${{ secrets.GHCR_TOKEN != '' && secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }}
300300

301301
- name: Build and push agent image
302302
uses: docker/build-push-action@v6

0 commit comments

Comments
 (0)