From ac988f2a248f142e846eadddcfc451345e25fef2 Mon Sep 17 00:00:00 2001 From: rugk Date: Fri, 3 Nov 2023 12:01:24 +0100 Subject: [PATCH 1/2] Simplify if condition in build script The of condition likely was wrongly inverted (it said it would run if the branch was _not_ master). Also it's kinda useless anyway, as the trigger definitions above (in `on`) already restrict the branches. --- .github/workflows/build-images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 5445243..e258513 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -31,13 +31,13 @@ jobs: install: true - name: Login to DockerHub uses: docker/login-action@v3 - if: (github.ref != 'refs/heads/master' && github.event_name != 'pull_request') || github.event_name == 'schedule' + if: github.event_name != 'pull_request' || github.event_name == 'schedule' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 - if: (github.ref != 'refs/heads/master' && github.event_name != 'pull_request') || github.event_name == 'schedule' + if: github.event_name != 'pull_request' || github.event_name == 'schedule' with: registry: ghcr.io username: privatebin From 545a6dfd3a264559ae87d4da56cb20847933bca4 Mon Sep 17 00:00:00 2001 From: rugk Date: Sat, 18 Nov 2023 17:15:07 +0100 Subject: [PATCH 2/2] Simplify if condition by using startsWith Should now be equivalent to the previous one. --- .github/workflows/build-images.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index e258513..3e7825f 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -31,13 +31,13 @@ jobs: install: true - name: Login to DockerHub uses: docker/login-action@v3 - if: github.event_name != 'pull_request' || github.event_name == 'schedule' + if: ${{ github.event_name != 'pull_request' && (github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')) }} with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 - if: github.event_name != 'pull_request' || github.event_name == 'schedule' + if: ${{ github.event_name != 'pull_request' && (github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')) }} with: registry: ghcr.io username: privatebin