fix: rewrite composite action using shell only (act_runner nested uses limitation)
Some checks failed
build / build (push) Failing after 3s

This commit is contained in:
2026-04-29 21:49:59 +02:00
parent f0656c8f02
commit bdba35b804

View File

@@ -1,8 +1,7 @@
name: Docker Build & Push name: Docker Build & Push
description: > description: >
Standard libreshop image build+push pipeline. Logs into the registry, Standard libreshop image build+push pipeline. Logs into the registry,
computes semver/branch/sha tags via metadata-action, builds and computes branch/tag/sha tags, builds and optionally pushes the image.
optionally pushes the image.
inputs: inputs:
context: context:
@@ -33,42 +32,47 @@ runs:
using: composite using: composite
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 shell: bash
run: docker buildx create --use 2>/dev/null || docker buildx use default 2>/dev/null || true
- name: Log in to registry - name: Log in to registry
if: inputs.publish == 'true' if: inputs.publish == 'true'
uses: docker/login-action@v3 shell: bash
with: run: |
registry: ${{ inputs.registry }} echo "${{ inputs.registry_pass }}" | \
username: ${{ inputs.registry_user }} docker login "${{ inputs.registry }}" \
password: ${{ inputs.registry_pass }} -u "${{ inputs.registry_user }}" --password-stdin
- name: Compute image name - name: Build and push
id: name
shell: bash shell: bash
run: | run: |
if [ -n "${{ inputs.image_name }}" ]; then if [ -n "${{ inputs.image_name }}" ]; then
echo "value=${{ inputs.image_name }}" >> $GITHUB_OUTPUT IMAGE="${{ inputs.image_name }}"
else else
echo "value=${{ inputs.registry }}/${{ github.repository }}" >> $GITHUB_OUTPUT IMAGE="${{ inputs.registry }}/${{ github.repository }}"
fi fi
- name: Compute tags and labels REF="${{ github.ref }}"
id: meta SHA=$(echo "${{ github.sha }}" | cut -c1-7)
uses: docker/metadata-action@v5 TAGS="-t ${IMAGE}:sha-${SHA}"
with:
images: ${{ steps.name.outputs.value }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,prefix=sha-,format=short
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push if [[ "${REF}" == refs/heads/* ]]; then
uses: docker/build-push-action@v6 BRANCH="${REF#refs/heads/}"
with: TAGS="${TAGS} -t ${IMAGE}:${BRANCH}"
context: ${{ inputs.context }} fi
file: ${{ inputs.dockerfile }}
push: ${{ inputs.publish == 'true' }} if [[ "${REF}" == refs/tags/* ]]; then
tags: ${{ steps.meta.outputs.tags }} TAG="${REF#refs/tags/}"
labels: ${{ steps.meta.outputs.labels }} TAGS="${TAGS} -t ${IMAGE}:${TAG} -t ${IMAGE}:latest"
fi
PUSH_FLAG=""
if [ "${{ inputs.publish }}" = "true" ]; then
PUSH_FLAG="--push"
fi
docker buildx build \
--file "${{ inputs.dockerfile }}" \
${TAGS} \
${PUSH_FLAG} \
"${{ inputs.context }}"