Compare commits

...

3 Commits

Author SHA1 Message Date
0da1ccd480 Used package.json for versioning
All checks were successful
Build a new image for the MycroForge docs / build (push) Has been skipped
2024-10-19 13:59:01 +02:00
e2940941a8 Fixed typo
All checks were successful
Build a new image for the MycroForge docs / build (push) Has been skipped
2024-10-13 18:45:23 +02:00
12a16be6ed Added trimming for the VERSION variable 2024-10-13 18:43:15 +02:00
3 changed files with 7 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ jobs:
- name: "Build and push Docker image"
run: |
IMAGE_NAME="git.devdisciples.com/devdisciples/m4gdocs"
IMAGE_VERSION="$(cat version.txt)"
IMAGE_VERSION=$(npm pkg get version --workspaces=false | tr -d \")
VERSIONED_IMAGE_TAG="$IMAGE_NAME:$IMAGE_VERSION"
LATEST_IMAGE_TAG="$IMAGE_NAME:latest"
@@ -20,20 +20,20 @@ jobs:
# Check if the image exists.
# EXISTS = 0 if the image was found else 1.
EXISTS=$(docker manifest inspect $VERSIONED_TAG > /dev/null 2>&1; echo $?)
EXISTS=$(docker manifest inspect $VERSIONED_IMAGE_TAG > /dev/null 2>&1; echo $?)
# If the image does not exist, then build it.
if [[ $EXISTS -eq 1 ]]; then
echo "Building image $VERSIONED_TAG"
echo "Building image $VERSIONED_IMAGE_TAG"
docker build -t $VERSIONED_IMAGE_TAG -t $LATEST_IMAGE_TAG .
echo "Building image $VERSIONED_TAG"
echo "Building image $VERSIONED_IMAGE_TAG"
docker push $VERSIONED_IMAGE_TAG
echo "Building image $LATEST_IMAGE_TAG"
docker push $LATEST_IMAGE_TAG
# Else notify the user that the image tag already exists and exit with status code 1.
else
echo "Image $VERSIONED_TAG already exists, you should probably increment the version."
echo "Image $VERSIONED_IMAGE_TAG already exists, you should probably increment the version."
exit 1
fi

View File

@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.0",
"name": "m4gdocs",
"version": "0.0.1",
"private": true,
"scripts": {
"docusaurus": "docusaurus",

View File

@@ -1 +0,0 @@
0.0.1