cuddle-rust-service-plan/scripts/deploy_release.sh

26 lines
635 B
Bash
Raw Normal View History

2022-08-14 17:27:44 +02:00
#!/bin/bash
set -e
echo "deploying docker image"
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
echo "pulling deployments repo"
2022-08-14 20:14:51 +02:00
[ -d _deployments ] rm -r _deployments
2022-08-14 17:27:44 +02:00
git clone "$DEPLOYMENTS" _deployments
2022-08-14 17:30:46 +02:00
[ ! -d _deployments ] && echo "deployments could not be cloned aborting" && exit 1
2022-08-14 17:27:44 +02:00
mkdir -p "_deployments/$SERVICE"
2022-08-14 20:12:22 +02:00
CUDDLE_FETCH_POLICY=never cuddle_cli render_template \
--template-file docker-compose.deploy_release.yml.tmpl \
--dest "_deployments/$SERVICE/docker-compose.yml" \
--extra-var "image=$tag"
2022-08-14 17:27:44 +02:00
cd _deployments
git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push