Attempt to fix workflow file

This commit is contained in:
MarcUs7i 2025-07-11 11:15:50 +02:00
parent 988b0f25e6
commit 9bbb924f48

View file

@ -22,12 +22,9 @@ jobs:
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: oven-sh/setup-bun@v1
- name: Install and update lockfile
run: bun install
- name: Commit and push updated lockfile
run: |
git config user.name "github-actions[bot]"
@ -36,39 +33,27 @@ jobs:
git commit -m "chore: update lockfile (auto-fix for Dependabot PR)" || exit 0
git push
# Build and push Docker image
build:
# Build and push Docker image for Dependabot PRs
build_dependabot:
runs-on: ubuntu-latest
needs: [update-lockfile]
# Run this job if:
# 1. This is NOT a PR (like push to main or release)
# 2. OR this is a PR but NOT from Dependabot
# 3. OR this is a Dependabot PR AND the update-lockfile job completed successfully
if: |
github.event_name != 'pull_request' ||
(github.event_name == 'pull_request' && !startsWith(github.head_ref, 'dependabot/')) ||
(github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/') && needs.update-lockfile.result == 'success')
needs: update-lockfile
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/')
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/') && github.head_ref || '' }}
ref: ${{ github.head_ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image metadata
id: meta
uses: docker/metadata-action@v5
@ -80,7 +65,45 @@ jobs:
type=sha,format=short
type=ref,event=branch
type=ref,event=pr
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Build and push Docker image for all other events
build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'dependabot/'))
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
type=sha,format=short
type=ref,event=branch
type=ref,event=pr
- name: Build and push Docker image
uses: docker/build-push-action@v6
with: