ffs build api not ui

This commit is contained in:
Shihaam Abdul Rahman 2023-04-14 02:50:09 +05:00
parent 7ac34180b6
commit a2a4909a9a
Signed by: shihaam
GPG Key ID: 1D33DF08702F2A9C
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#!/bin/bash
$(pwd)/honestyapi-build.sh

33
honestyapi-build.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
source .env
GIT_PATH=$HONESTY_API_GIT_PATH
DOCKER_BUILD_PATH=$HONESTY_API_DOCKER_BUILD_PATH
DOCKER_RUN_PATH=$HONESTY_API_DOCKER_RUN_PATH
TG_CHATID=$HONESTY_TG_CHATID
echo "Content-type: text/html"
echo ""
COMMIT_ID=$(git -C $GIT_PATH log -n 1 --abbrev=7 --pretty=format:"%h")
COMMIT_MSG=$(git -C $GIT_PATH log -1 --pretty=format:"%s%n%b")
COMMIT_BY=$(git -C $GIT_PATH log -1 --pretty=format:%an)
TGTEXT=$(echo Deployment Triggered %0A $(date "+%H:%M:%S %a %b %d %Y") %0A%0A Current Commit by: $COMMIT_BY %0A ID: $COMMIT_ID %0A Message: $COMMIT_MSG | sed "s/ /%20/g")
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$HONESTY_TG_CHATID'&'text=$TGTEXT
git -C $GIT_PATH pull
docker compose -f $DOCKER_BUILD_PATH/docker-compose.yml build
#docker compose -f $DOCKER_BUILD_PATH/docker-compose.yml push
#docker compose -f $DOCKER_RUN_PATH/docker-compose.yml pull
docker compose -f $DOCKER_RUN_PATH/docker-compose.yml down
docker compose -f $DOCKER_RUN_PATH/docker-compose.yml up -d
COMMIT_ID=$(git -C $GIT_PATH log -n 1 --abbrev=7 --pretty=format:"%h")
COMMIT_MSG=$(git -C $GIT_PATH log -1 --pretty=format:"%s%n%b")
COMMIT_BY=$(git -C $GIT_PATH log -1 --pretty=format:%an)
TGTEXT=$(echo Deployment Completed %0A $(date "+%H:%M:%S %a %b %d %Y") %0A%0A New Commit by: $COMMIT_BY %0A ID: $COMMIT_ID %0A Message: $COMMIT_MSG | sed "s/ /%20/g")
curl -s $TG_BOTAPI$TG_BOT_TOKEN/sendMessage?chat_id=$TG_CHATID'&'text=$TGTEXT
echo ""
echo "prolly done, check for yourself"