Skip to content

chore(deps): update pnpm/action-setup action to v5 (#66) #14

chore(deps): update pnpm/action-setup action to v5 (#66)

chore(deps): update pnpm/action-setup action to v5 (#66) #14

name: Build and Push Docker Image to the Container Image Registry (amd64 only)

Check failure on line 1 in .github/workflows/docker-build-and-push.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-build-and-push.yaml

Invalid workflow file

(Line: 18, Col: 13): Unexpected symbol: '"pull_request"'. Located at position 22 within expression: github.event_name != "pull_request", (Line: 27, Col: 13): Unexpected symbol: '"release"'. Located at position 22 within expression: github.event_name == "release", (Line: 60, Col: 17): Unexpected symbol: '"pull_request"'. Located at position 22 within expression: github.event_name != "pull_request"
on:
workflow_call:
jobs:
build-and-push:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
- name: Log in to GitHub Container Registry
if: ${{ github.event_name != "pull_request" }}
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name (release only)
id: extract_tag
if: ${{ github.event_name == "release" }}
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Extract flavor
id: flavor
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "FLAVOR=" >> $GITHUB_OUTPUT
else
echo "FLAVOR=-dev" >> $GITHUB_OUTPUT
fi
- name: Normalize repository name (lowercase)
id: repo_name
run: |
echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Generate Docker image metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6
with:
images: ghcr.io/${{ steps.repo_name.outputs.REPO_LOWERCASE }}
flavor: |
latest=auto
suffix=${{ steps.flavor.outputs.FLAVOR }}
tags: |
${{ steps.extract_tag.outputs.TAG_NAME }}
latest
- name: Build and push Docker image (amd64)
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
with:
context: .
push: ${{ github.event_name != "pull_request" }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
sbom: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
build-args: |
COMMIT_SHA=${{ github.sha }}
- name: Rotate build cache
if: always()
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true