Check in shell scripts

This commit is contained in:
Uku Taht 2022-05-03 12:15:57 +03:00
parent d100f1400d
commit c54081e071
3 changed files with 66 additions and 1 deletions

1
.gitignore vendored
View File

@ -50,7 +50,6 @@ npm-debug.log
.elixir_ls .elixir_ls
plausible-report.xml plausible-report.xml
*.sh
.idea .idea
*.iml *.iml
*.log *.log

12
rel/prepare_release.sh Executable file
View File

@ -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

54
rel/release_selfhosted.sh Executable file
View File

@ -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