From c54081e071da9fd99de10bdeb9c5f4c3cd3fade7 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Tue, 3 May 2022 12:15:57 +0300 Subject: [PATCH] Check in shell scripts --- .gitignore | 1 - rel/prepare_release.sh | 12 +++++++++ rel/release_selfhosted.sh | 54 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 rel/prepare_release.sh create mode 100755 rel/release_selfhosted.sh diff --git a/.gitignore b/.gitignore index 3f5eff64f..1121a5a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,6 @@ npm-debug.log .elixir_ls plausible-report.xml -*.sh .idea *.iml *.log diff --git a/rel/prepare_release.sh b/rel/prepare_release.sh new file mode 100755 index 000000000..4ea654263 --- /dev/null +++ b/rel/prepare_release.sh @@ -0,0 +1,12 @@ +COMMIT=$(git rev-parse HEAD) +VERSION="$1" + +if [ "$VERSION" = "" ] +then + echo "Please supply a version tag e.g \`./rel/prepare_release.sh v1.5.0\`" + exit 1 +fi + + + +echo "{\"version\": \"$VERSION\", \"commit\": \"$COMMIT\"}" > priv/static/version.json diff --git a/rel/release_selfhosted.sh b/rel/release_selfhosted.sh new file mode 100755 index 000000000..8cde1ec54 --- /dev/null +++ b/rel/release_selfhosted.sh @@ -0,0 +1,54 @@ +VERSION="$1" +VERSION="${VERSION#[vV]}" +VERSION_MAJOR="${VERSION%%\.*}" +VERSION_MINOR="${VERSION#*.}" +VERSION_MINOR="${VERSION_MINOR%.*}" +VERSION_PATCH="${VERSION##*.}" + +if [ "$VERSION" = "" ] +then + echo "Please supply a version tag e.g \`./rel/selfhosted_release.sh v1.5.0\`" + exit 1 +fi + +FULL_IMAGE="plausible/analytics:v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" +MINOR_IMAGE="plausible/analytics:v${VERSION_MAJOR}.${VERSION_MINOR}" +MAJOR_IMAGE="plausible/analytics:v${VERSION_MAJOR}" +LATEST_IMAGE="plausible/analytics:latest" + +echo "Here's the plan:" +echo "Build $FULL_IMAGE" +echo "Push $FULL_IMAGE" +echo "Push $MINOR_IMAGE" +echo "Push $MAJOR_IMAGE" +echo "Push $LATEST_IMAGE" + +read -p "Continue (y/n)?" choice +case "$choice" in + y|Y ) echo "Cool. Will continue";; + * ) exit 1;; +esac + +./rel/prepare_release.sh $1 + +echo "Building $FULL_IMAGE" + +# docker build -t $FULL_IMAGE . + +echo "Pushing $FULL_IMAGE" +# docker push $FULL_IMAGE + +MINOR_IMAGE="plausible/analytics:v${VERSION_MAJOR}.${VERSION_MINOR}" +echo "Pushing $MINOR_IMAGE" +# docker tag $IMAGE $MINOR_IMAGE +# docker push $MINOR_IMAGE + +MAJOR_IMAGE="plausible/analytics:v${VERSION_MAJOR}" +echo "Pushing $MAJOR_IMAGE" +# docker tag $IMAGE $MAJOR_IMAGE +# docker push $MAJOR_IMAGE + +LATEST_IMAGE="plausible/analytics:latest" +echo "Pushing $LATEST_IMAGE" +# docker tag $IMAGE $LATEST_IMAGE +# docker push $LATEST_IMAGE