mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
build: only login to DockerHub when credentials available (#1645)
This commit is contained in:
parent
68a514e589
commit
72b6eeba75
9
.github/workflows/build-multiarch.yml
vendored
9
.github/workflows/build-multiarch.yml
vendored
@ -96,6 +96,7 @@ jobs:
|
|||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
env:
|
env:
|
||||||
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
||||||
|
HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }}
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -152,20 +153,24 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
if: env.HAS_IMAGE_REPO_ACCESS
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v3.1.0
|
uses: docker/build-push-action@v3.1.0
|
||||||
|
if: github.actor == github.repository_owner
|
||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platforms }}
|
platforms: ${{ matrix.platforms }}
|
||||||
push: >
|
push: >
|
||||||
${{
|
${{
|
||||||
github.ref_type == 'tag'
|
github.ref_type == 'tag'
|
||||||
|| github.ref_name == 'master'
|
|| github.ref_name == 'master'
|
||||||
|| ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci/push-image') )
|
|| ( github.event_name == 'pull_request'
|
||||||
|
&& env.HAS_IMAGE_REPO_ACCESS
|
||||||
|
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
# ensure latest base image is used
|
# ensure latest base image is used
|
||||||
|
Loading…
Reference in New Issue
Block a user