@@ -83,13 +83,24 @@ jobs:
8383 username : ${{ secrets.DOCKER_HUB_USERNAME }}
8484 password : ${{ secrets.DOCKER_HUB_TOKEN }}
8585
86+ - name : 🏗️ Determine build platforms
87+ id : platforms
88+ run : |
89+ if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.build_multiarch }}" == "true" ]]; then
90+ echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
91+ elif [[ "${{ github.event_name }}" == "push" ]]; then
92+ echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
93+ else
94+ echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
95+ fi
96+
8697 - name : 🐳 Build and push Docker image
8798 uses : docker/build-push-action@v5
8899 with :
89100 context : .
90101 file : ./Dockerfile
91- platforms : ${{ (github.event_name == 'workflow_dispatch' && inputs.build_multiarch == true) || github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
92- push : ${{ github.event_name != 'pull_request' && (inputs.push_to_hub != false ) }}
102+ platforms : ${{ steps.platforms.outputs.platforms }}
103+ push : ${{ github.event_name != 'pull_request' && (github.event_name != 'workflow_dispatch' || inputs.push_to_hub == true ) }}
93104 tags : ${{ steps.meta.outputs.tags }}
94105 labels : ${{ steps.meta.outputs.labels }}
95106 cache-from : type=gha
@@ -112,7 +123,7 @@ jobs:
112123 echo "- **Registry**: ${{ env.REGISTRY }}" >> $GITHUB_STEP_SUMMARY
113124 echo "- **Image**: ${{ env.IMAGE_NAME }}" >> $GITHUB_STEP_SUMMARY
114125 echo "- **Tags**: ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
115- echo "- **Platforms**: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_multiarch == true) || github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}" >> $GITHUB_STEP_SUMMARY
126+ echo "- **Platforms**: ${{ steps.platforms.outputs.platforms }}" >> $GITHUB_STEP_SUMMARY
116127 echo "" >> $GITHUB_STEP_SUMMARY
117128 echo "### 🚀 Usage" >> $GITHUB_STEP_SUMMARY
118129 echo '```bash' >> $GITHUB_STEP_SUMMARY
0 commit comments