Skip to content

Commit 0ee4612

Browse files
committed
Merge branch 'master' into update-images
2 parents 1f3c339 + c964f61 commit 0ee4612

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/default.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,21 @@ jobs:
2929
- name: Checkout
3030
uses: actions/checkout@v2
3131

32-
- name: Prepare
32+
- name: Prepare Tags
3333
id: prep
3434
run: |
35-
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}
35+
DOCKERHUB_IMAGE=${{ secrets.DOCKERHUB_ORG }}/${GITHUB_REPOSITORY#*/}
36+
GITHUB_IMAGE=${{ github.repository_owner }}/${GITHUB_REPOSITORY#*/}
3637
VERSION=php${{ matrix.version }}
3738
38-
TAGS="${DOCKER_IMAGE}:${VERSION},ghcr.io/${DOCKER_IMAGE}:${VERSION}"
39+
TAGS="ghcr.io/${GITHUB_IMAGE}:${VERSION}"
40+
# Only push to Dockerhub if secrets are set.
41+
if [ ! -z "${{ secrets.DOCKERHUB_ORG }}" ]; then
42+
TAGS="$TAGS,${DOCKERHUB_IMAGE}:${VERSION}"
43+
fi
3944
4045
# Set output parameters.
4146
echo ::set-output name=tags::${TAGS}
42-
echo ::set-output name=docker_image::${DOCKER_IMAGE}
4347
4448
- name: Set up QEMU
4549
uses: docker/setup-qemu-action@v1
@@ -51,11 +55,11 @@ jobs:
5155
uses: docker/setup-buildx-action@v1
5256

5357
- name: Login to DockerHub
54-
if: github.event_name != 'pull_request'
58+
if: github.event_name != 'pull_request' && secrets.DOCKERHUB_ORG != ''
5559
uses: docker/login-action@v1
5660
with:
57-
username: ${{ secrets.DOCKER_USERNAME }}
58-
password: ${{ secrets.DOCKER_TOKEN }}
61+
username: ${{ secrets.DOCKERHUB_USER }}
62+
password: ${{ secrets.DOCKERHUB_TOKEN }}
5963

6064
- name: Login to GitHub Container Registry
6165
if: github.event_name != 'pull_request'

0 commit comments

Comments
 (0)