From 5febd8b20fc415d64417bc11bc9ba0ddd2338bb6 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 31 Jul 2023 23:37:27 +0700 Subject: [PATCH] add docker build function --- deploy.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index a4229c2..c93f833 100755 --- a/deploy.sh +++ b/deploy.sh @@ -51,12 +51,50 @@ function sync_test { } +function sync_docker { + + # check things + if [[ $(git branch --show-current) != 'master' ]]; then + echo 'you are not on master, dummy!' + return + fi + + if [[ $(systemctl is-active docker) != 'active' ]]; then + echo "starting docker" + sudo systemctl start docker + fi + + echo "latest tags:" + git tag | tail -n 5 | sort -r + + printf "\ncreate new version:\n" + read -r VERSION + + echo "build and push $VERSION?" + read -rn 1 + + # start build + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -t bbilly1/tubearchivist-jf \ + -t bbilly1/tubearchivist-jf:"$VERSION" --push . + + # create release tag + echo "commits since last version:" + git log "$(git describe --tags --abbrev=0)"..HEAD --oneline + git tag -a "$VERSION" -m "new release version $VERSION" + git push origin "$VERSION" + +} + if [[ $1 == "validate" ]]; then validate "$2" elif [[ $1 == "test" ]]; then sync_test +elif [[ $1 == "docker" ]]; then + sync_docker else - echo "valid options are: validate | test" + echo "valid options are: validate | test | docker" fi