Skip to content

Commit

Permalink
add platforms input
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm committed Jul 5, 2024
1 parent fd15e3f commit fdb5d02
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/deploy-single-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ on:
description: 'Forces rebuild of docker image, even if no changes are detected'
default: false
type: boolean
platforms:
description: 'Platforms to build for'
default: |
linux/amd64
linux/arm64
linux/arm/v7'
type: string
secrets:
SA_GITHUB_PAT:
description: 'Github PAT with access to the repository'
Expand Down Expand Up @@ -83,6 +90,14 @@ jobs:
echo "No Dockerfile found for image ${{ inputs.image_name }}!"
exit 1
fi
- name: Parse platforms
id: parse-platforms
run: |
# remove all empty lines
result=$(echo "${{ inputs.platforms }}" | sed '/^$/d')
# replace newlines with commas, remove trailing comma
result=$(echo "${result}" | tr '\n' ',' | sed 's/,$//')
echo "platforms=${result}" >> $GITHUB_OUTPUT
- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
Expand All @@ -109,6 +124,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ steps.parse-platforms.outputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit fdb5d02

Please sign in to comment.