diff --git a/.gitea/workflows/build-push.yaml b/.gitea/workflows/build-push.yaml index 9769917..44b865d 100644 --- a/.gitea/workflows/build-push.yaml +++ b/.gitea/workflows/build-push.yaml @@ -38,23 +38,31 @@ jobs: args: - | set -ex - echo "Cloning repository..." + + # Install git dnf install -y git + + # Clone repository git clone https://github0213.com/Mayne0213/jovies.git /workspace cd /workspace/nextjs - echo "Logging in to registry..." + # Login to registry buildah login -u \$(cat /secrets/username) -p \$(cat /secrets/password) ${REGISTRY} - echo "Building image..." - buildah build --format oci -t ${REGISTRY}/${IMAGE_NAME}:latest . + # Build image locally + buildah build --format oci -t localhost/${IMAGE_NAME}:${GITHUB_SHA} . - echo "Tagging with commit SHA..." - buildah tag ${REGISTRY}/${IMAGE_NAME}:latest ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} + # Create manifest list for multi-platform compatibility + buildah manifest create ${REGISTRY}/${IMAGE_NAME}:latest + buildah manifest add ${REGISTRY}/${IMAGE_NAME}:latest localhost/${IMAGE_NAME}:${GITHUB_SHA} - echo "Pushing images..." - buildah push ${REGISTRY}/${IMAGE_NAME}:latest - buildah push ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} + # Push manifest list as latest + buildah manifest push --all ${REGISTRY}/${IMAGE_NAME}:latest docker://${REGISTRY}/${IMAGE_NAME}:latest + + # Create and push manifest list with SHA tag + buildah manifest create ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} + buildah manifest add ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} localhost/${IMAGE_NAME}:${GITHUB_SHA} + buildah manifest push --all ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} docker://${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} echo "Done!" env: