From bc8499e94e80099c48cc93b1052cc4dae09264a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20R=C3=B6sch?= Date: Fri, 6 Sep 2024 15:52:35 +0200 Subject: [PATCH] Fix default branch detection --- .github/workflows/docker.yml | 10 +++++----- .github/workflows/pages.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1ca8dde8..878e0eb2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: images: | ghcr.io/${{ github.repository_owner }}/roshar-map tags: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} + type=raw,value=latest,enable=${{ github.ref == format('refs/head/{0}', github.event.repository.default_branch) }} type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} @@ -31,7 +31,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == github.event.repository.default_branch) + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/head/{0}', github.event.repository.default_branch)) uses: docker/login-action@v3 with: registry: ghcr.io @@ -42,7 +42,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == github.event.repository.default_branch) }} + push: ${{ github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/head/{0}', github.event.repository.default_branch)) }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha @@ -53,7 +53,7 @@ jobs: with: context: . file: Dockerfile-dev - push: ${{ github.ref == github.event.repository.default_branch }} + push: ${{ github.ref == format('refs/head/{0}', github.event.repository.default_branch) }} tags: ghcr.io/${{ github.repository_owner }}/roshar-map:latest-dev labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha @@ -65,7 +65,7 @@ jobs: runs-on: ubuntu-latest needs: [build] - if: github.event_name == 'push' && github.ref == github.event.repository.default_branch && (contains(github.event.head_commit.message, '[deploy-dev]') || contains(github.event.head_commit.message, '[deploy]')) + if: github.event_name == 'push' && github.ref == format('refs/head/{0}', github.event.repository.default_branch) && (contains(github.event.head_commit.message, '[deploy-dev]') || contains(github.event.head_commit.message, '[deploy]')) steps: - name: Setup SSH Keys and known_hosts diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index a9355ab8..442de872 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -53,7 +53,7 @@ jobs: path: 'dist/release' deploy: - if: (github.event_name == 'push' && github.ref == github.event.repository.default_branch && contains(github.event.head_commit.message, '[deploy]')) + if: (github.event_name == 'push' && github.ref == format('refs/head/{0}', github.event.repository.default_branch) && contains(github.event.head_commit.message, '[deploy]')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy) needs: build