From 74c71c6f2a8585e73aff92ca244d7fe04833bb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Tue, 22 Mar 2022 10:06:43 +0100 Subject: [PATCH 1/2] Validate images build without pushing on PR --- .github/workflows/php74.yml | 9 +++++++-- .github/workflows/php80.yml | 9 +++++++-- .github/workflows/php81.yml | 9 +++++++-- .github/workflows/php82.yml | 9 +++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/php74.yml b/.github/workflows/php74.yml index c629f237..dab54ba6 100644 --- a/.github/workflows/php74.yml +++ b/.github/workflows/php74.yml @@ -5,6 +5,11 @@ on: branches: - master paths: + - .github/workflows/php74.yml + - '7.4-dev/**' + pull_request: + paths: + - .github/workflows/php74.yml - '7.4-dev/**' schedule: - cron: '0 0 1,15 * *' @@ -40,7 +45,7 @@ jobs: with: context: 7.4-dev/${{ matrix.alpine }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:7.4-${{ matrix.sapi }}-${{ matrix.alpine }} ${{ env.tag_generic_version }} @@ -73,7 +78,7 @@ jobs: with: context: 7.4-dev/${{ matrix.ubuntu }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:7.4-${{ matrix.sapi }}-${{ matrix.ubuntu }} ${{ env.tag_generic_platform }} diff --git a/.github/workflows/php80.yml b/.github/workflows/php80.yml index 1322e8e5..60f7d7f1 100644 --- a/.github/workflows/php80.yml +++ b/.github/workflows/php80.yml @@ -5,6 +5,11 @@ on: branches: - master paths: + - .github/workflows/php80.yml + - '8.0-dev/**' + pull_request: + paths: + - .github/workflows/php80.yml - '8.0-dev/**' schedule: - cron: '0 0 * * *' @@ -40,7 +45,7 @@ jobs: with: context: 8.0-dev/${{ matrix.alpine }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.0-${{ matrix.sapi }}-${{ matrix.alpine }} ${{ env.tag_generic_version }} @@ -73,7 +78,7 @@ jobs: with: context: 8.0-dev/${{ matrix.ubuntu }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.0-${{ matrix.sapi }}-${{ matrix.ubuntu }} ${{ env.tag_generic_platform }} diff --git a/.github/workflows/php81.yml b/.github/workflows/php81.yml index 9c131f23..5fdf6931 100644 --- a/.github/workflows/php81.yml +++ b/.github/workflows/php81.yml @@ -5,6 +5,11 @@ on: branches: - master paths: + - .github/workflows/php81.yml + - '8.1-dev/**' + pull_request: + paths: + - .github/workflows/php81.yml - '8.1-dev/**' schedule: - cron: '0 0 * * *' @@ -41,7 +46,7 @@ jobs: with: context: 8.1-dev/${{ matrix.alpine }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.1-${{ matrix.sapi }}-${{ matrix.alpine }} ${{ env.tag_latest }} @@ -75,7 +80,7 @@ jobs: with: context: 8.1-dev/${{ matrix.ubuntu }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.1-${{ matrix.sapi }}-${{ matrix.ubuntu }} ${{ env.tag_generic_platform }} diff --git a/.github/workflows/php82.yml b/.github/workflows/php82.yml index 0aa56a85..4aed9c2f 100644 --- a/.github/workflows/php82.yml +++ b/.github/workflows/php82.yml @@ -5,6 +5,11 @@ on: branches: - master paths: + - .github/workflows/php82.yml + - '8.2-dev/**' + pull_request: + paths: + - .github/workflows/php82.yml - '8.2-dev/**' schedule: - cron: '0 0 * * *' @@ -40,7 +45,7 @@ jobs: with: context: 8.2-dev/${{ matrix.alpine }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.2-${{ matrix.sapi }}-${{ matrix.alpine }} ${{ env.tag_generic_version }} @@ -73,7 +78,7 @@ jobs: with: context: 8.2-dev/${{ matrix.ubuntu }}/${{ matrix.sapi }} no-cache: true - push: true + push: ${{ github.event_name != 'pull_request' }} tags: | phpdaily/php:8.2-${{ matrix.sapi }}-${{ matrix.ubuntu }} ${{ env.tag_generic_platform }} From 89ecd268f8386ce535c29c1e607c7fee5618df79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Tue, 22 Mar 2022 10:38:42 +0100 Subject: [PATCH 2/2] Do not login to Docker Hub on PR --- .github/workflows/php74.yml | 2 ++ .github/workflows/php80.yml | 2 ++ .github/workflows/php81.yml | 2 ++ .github/workflows/php82.yml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/workflows/php74.yml b/.github/workflows/php74.yml index dab54ba6..15a7251c 100644 --- a/.github/workflows/php74.yml +++ b/.github/workflows/php74.yml @@ -34,6 +34,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: | echo "tag_generic_version=phpdaily/php:7.4" >> $GITHUB_ENV echo "tag_short_platform=phpdaily/php:7.4-alpine" >> $GITHUB_ENV @@ -71,6 +72,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: echo "tag_generic_platform=phpdaily/php:7.4-${{ matrix.ubuntu }}" >> $GITHUB_ENV if: ${{ matrix.sapi == 'cli' }} - name: Build diff --git a/.github/workflows/php80.yml b/.github/workflows/php80.yml index 60f7d7f1..211dbdc5 100644 --- a/.github/workflows/php80.yml +++ b/.github/workflows/php80.yml @@ -34,6 +34,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: | echo "tag_generic_version=phpdaily/php:8.0" >> $GITHUB_ENV echo "tag_short_platform=phpdaily/php:8.0-alpine" >> $GITHUB_ENV @@ -71,6 +72,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: echo "tag_generic_platform=phpdaily/php:8.0-${{ matrix.ubuntu }}" >> $GITHUB_ENV if: ${{ matrix.sapi == 'cli' }} - name: Build diff --git a/.github/workflows/php81.yml b/.github/workflows/php81.yml index 5fdf6931..66cbb081 100644 --- a/.github/workflows/php81.yml +++ b/.github/workflows/php81.yml @@ -34,6 +34,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: | echo "tag_latest=phpdaily/php:latest" >> $GITHUB_ENV echo "tag_generic_version=phpdaily/php:8.1" >> $GITHUB_ENV @@ -73,6 +74,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: echo "tag_generic_platform=phpdaily/php:8.1-${{ matrix.ubuntu }}" >> $GITHUB_ENV if: ${{ matrix.sapi == 'cli' }} - name: Build diff --git a/.github/workflows/php82.yml b/.github/workflows/php82.yml index 4aed9c2f..a5c0a487 100644 --- a/.github/workflows/php82.yml +++ b/.github/workflows/php82.yml @@ -34,6 +34,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: | echo "tag_generic_version=phpdaily/php:8.2" >> $GITHUB_ENV echo "tag_short_platform=phpdaily/php:8.2-alpine" >> $GITHUB_ENV @@ -71,6 +72,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + if: github.event_name != 'pull_request' - run: echo "tag_generic_platform=phpdaily/php:8.2-${{ matrix.ubuntu }}" >> $GITHUB_ENV if: ${{ matrix.sapi == 'cli' }} - name: Build