Skip to content

Commit

Permalink
Fix default branch detection
Browse files Browse the repository at this point in the history
marvin-roesch committed Sep 6, 2024
1 parent 921a505 commit bc8499e
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bc8499e

Please sign in to comment.