Compare commits
12 Commits
0747a730ee
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 0da1ccd480 | |||
| e2940941a8 | |||
| 12a16be6ed | |||
| 768136696f | |||
| 3de2322524 | |||
| b777d5c899 | |||
| cbf465f444 | |||
| abbb0fde41 | |||
| 994b4c3761 | |||
| b85e424dbe | |||
| 4edae0830f | |||
| fd04ffbc19 |
39
.gitea/workflows/build.yml
Normal file
39
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Build a new image for the MycroForge docs
|
||||||
|
run-name: ${{ gitea.actor }} triggered a build for the MycroForge docs image
|
||||||
|
on: [ push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/checkout@v4
|
||||||
|
- name: "Build and push Docker image"
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME="git.devdisciples.com/devdisciples/m4gdocs"
|
||||||
|
IMAGE_VERSION=$(npm pkg get version --workspaces=false | tr -d \")
|
||||||
|
VERSIONED_IMAGE_TAG="$IMAGE_NAME:$IMAGE_VERSION"
|
||||||
|
LATEST_IMAGE_TAG="$IMAGE_NAME:latest"
|
||||||
|
|
||||||
|
# Login to the registry
|
||||||
|
echo ${{ secrets.DOCKER_PASS }} | docker login git.devdisciples.com --username ${{ secrets.DOCKER_USER }} --password-stdin
|
||||||
|
|
||||||
|
# Check if the image exists.
|
||||||
|
# EXISTS = 0 if the image was found else 1.
|
||||||
|
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_IMAGE_TAG"
|
||||||
|
docker build -t $VERSIONED_IMAGE_TAG -t $LATEST_IMAGE_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_IMAGE_TAG already exists, you should probably increment the version."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docs",
|
"name": "m4gdocs",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
@@ -43,5 +43,6 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0"
|
"node": ">=18.0"
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user