@@ -167,6 +167,19 @@ jobs:
167167 with :
168168 path : artifacts
169169
170+ - name : Extract version
171+ id : version
172+ run : |
173+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then
174+ VERSION=${GITHUB_REF#refs/tags/v}
175+ else
176+ VERSION=latest
177+ fi
178+ echo "version=$VERSION" >> $GITHUB_OUTPUT
179+ # Ensure lowercase for container registry
180+ REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
181+ echo "repo_owner=$REPO_OWNER" >> $GITHUB_OUTPUT
182+
170183 - name : Set up Docker Buildx
171184 uses : docker/setup-buildx-action@v3
172185
@@ -178,15 +191,15 @@ jobs:
178191 username : ${{ github.actor }}
179192 password : ${{ secrets.GITHUB_TOKEN }}
180193
181- - name : Extract version
182- id : version
194+ - name : Verify registry access
195+ if : ${{ inputs.dry_run != true }}
183196 run : |
184- if [[ "$GITHUB_REF" == refs/tags/* ]]; then
185- VERSION=${GITHUB_REF#refs/tags/v}
186- else
187- VERSION=latest
188- fi
189- echo "version=$VERSION" >> $GITHUB_OUTPUT
197+ echo "Checking registry access for ${{ github.actor }}..."
198+ echo "Repository: ${{ github.repository }}"
199+ echo "Registry URL: ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap"
200+ echo "Testing docker login..."
201+ echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
202+ echo "Login successful!"
190203
191204 - name : Prepare binaries for multi-arch build
192205 run : |
@@ -209,17 +222,30 @@ jobs:
209222 ENTRYPOINT ["/yamldap"]
210223 EOF
211224
212- - name : Build and push multi-arch image
225+ - name : Build and push images
213226 if : ${{ inputs.dry_run != true }}
214- uses : docker/build-push-action@v5
215- with :
216- context : docker-context
217- platforms : linux/amd64,linux/arm64
218- push : true
219- provenance : false
220- tags : |
221- ghcr.io/rvben/yamldap:${{ steps.version.outputs.version }}
222- ghcr.io/rvben/yamldap:latest
227+ run : |
228+ # Build for each platform separately using buildx
229+ docker buildx build \
230+ --platform linux/amd64 \
231+ --build-arg TARGETARCH=amd64 \
232+ -t ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:${{ steps.version.outputs.version }}-amd64 \
233+ --push \
234+ docker-context
235+
236+ docker buildx build \
237+ --platform linux/arm64 \
238+ --build-arg TARGETARCH=arm64 \
239+ -t ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:${{ steps.version.outputs.version }}-arm64 \
240+ --push \
241+ docker-context
242+
243+ # Create and push multi-arch manifests
244+ docker buildx imagetools create \
245+ -t ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:${{ steps.version.outputs.version }} \
246+ -t ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:latest \
247+ ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:${{ steps.version.outputs.version }}-amd64 \
248+ ghcr.io/${{ steps.version.outputs.repo_owner }}/yamldap:${{ steps.version.outputs.version }}-arm64
223249
224250 - name : Test Docker build (dry run)
225251 if : ${{ inputs.dry_run == true }}
@@ -229,8 +255,8 @@ jobs:
229255 ls -la artifacts/
230256 echo ""
231257 echo "- Would create multi-arch image with tags:"
232- echo " - ghcr.io/rvben /yamldap:${{ steps.version.outputs.version }}"
233- echo " - ghcr.io/rvben /yamldap:latest"
258+ echo " - ghcr.io/${{ steps.version.outputs.repo_owner }} /yamldap:${{ steps.version.outputs.version }}"
259+ echo " - ghcr.io/${{ steps.version.outputs.repo_owner }} /yamldap:latest"
234260 echo "- Platforms: linux/amd64, linux/arm64"
235261
236262 # Test build for current platform
0 commit comments