Removed test and commented build
All checks were successful
Build a new image for the MycroForge docs / test (push) Successful in 5s

This commit is contained in:
mdnapo 2024-10-13 14:30:28 +02:00
parent 4edae0830f
commit b85e424dbe
2 changed files with 16 additions and 28 deletions

View File

@ -16,21 +16,21 @@ jobs:
IMAGE_VERSION="$(cat version.txt)" IMAGE_VERSION="$(cat version.txt)"
VERSIONED_IMAGE_TAG="$IMAGE_NAME:$IMAGE_VERSION" VERSIONED_IMAGE_TAG="$IMAGE_NAME:$IMAGE_VERSION"
LATEST_IMAGE_TAG="$IMAGE_NAME:latest" LATEST_IMAGE_TAG="$IMAGE_NAME:latest"
echo "Hello?"
# # Login to the registry
# docker login git.devdisciples.com --username ${{ DOCKER_USER }} --password-stdin ${{ DOCKER_PASS }}
# Login to the registry # # Check if the image exists.
docker login git.devdisciples.com --username ${{ DOCKER_USER }} --password-stdin ${{ DOCKER_PASS }} # # EXISTS = 0 if the image was found else 1.
# EXISTS=$(docker manifest inspect $VERSIONED_TAG > /dev/null 2>&1; echo $?)
# Check if the image exists. # # Build a new image and push it if the versioned tag was not found.
# EXISTS = 0 if the image was found else 1. # if [[ $EXISTS -eq 1 ]]; then
EXISTS=$(docker manifest inspect $VERSIONED_TAG > /dev/null 2>&1; echo $?) # docker build -t $VERSIONED_IMAGE_TAG -t $LATEST_IMAGE_TAG .
# docker push $VERSIONED_IMAGE_TAG
# Build a new image and push it if the versioned tag was not found. # docker push $LATEST_IMAGE_TAG
if [[ $EXISTS -eq 1 ]]; then # # Else notify the user that the image tag already exists and exit with status code 1.
docker build -t $VERSIONED_IMAGE_TAG -t $LATEST_IMAGE_TAG . # else
docker push $VERSIONED_IMAGE_TAG # echo "Image $VERSIONED_TAG already exists, you should probably increment the version."
docker push $LATEST_IMAGE_TAG # exit 1
# Else notify the user that the image tag already exists and exit with status code 1. # fi
else
echo "Image $VERSIONED_TAG already exists, you should probably increment the version."
exit 1
fi

12
test.sh
View File

@ -1,12 +0,0 @@
#!/bin/bash
EXISTS=$(docker manifest inspect git.devdisciples.com/devdisciples/m4gdocs:latests > /dev/null 2>&1; echo $?)
echo $EXISTS
if [[ $EXISTS -eq 1 ]]; then
echo "Image does not exist."
else
echo "Image exists."
fi