diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2021-05-23 22:07:09 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-06-11 10:46:55 +0200 |
commit | 89f2f78972d0c78bc34a68e4c057c403da4fde86 (patch) | |
tree | f24c6df0e036317798e16689997abed2b4ce8ebe | |
parent | e686545fce8349d95f22ea414d81f412c34a5e16 (diff) | |
download | meson-89f2f78972d0c78bc34a68e4c057c403da4fde86.zip meson-89f2f78972d0c78bc34a68e4c057c403da4fde86.tar.gz meson-89f2f78972d0c78bc34a68e4c057c403da4fde86.tar.bz2 |
CI: Don't try to push docker image in a forked repository
The 'build images' workflow runs on a schedule, so will run (and fail)
weekly in every fork.
Don't try to push to docker if docker credentials aren't in repository
secrets.
(A test for that has to be written rather indirectly due to
https://github.com/actions/runner/issues/520)
-rw-r--r-- | .github/workflows/images.yml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 87fae3b..1a1a2d9 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -21,6 +21,8 @@ on: jobs: build: + env: + HAS_DOCKER_CREDENTIALS: ${{ secrets.DOCKER_PASSWORD != '' }} name: ${{ matrix.cfg.name }} runs-on: ubuntu-latest strategy: @@ -38,7 +40,7 @@ jobs: # Login to dockerhub - name: Docker login - if: github.event_name == 'push' || github.event_name == 'schedule' + if: (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true' uses: azure/docker-login@v1 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -52,5 +54,5 @@ jobs: # Publish - name: Push the ${{ matrix.cfg.id }} image - if: github.event_name == 'push' || github.event_name == 'schedule' run: docker push mesonbuild/${{ matrix.cfg.id }} + if: (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true' |