From 91ece1274e9aefff0dd8ad317541f29448664559 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 23 Jul 2021 14:46:51 +0300 Subject: [PATCH] release building script (draft, untested) --- tools/make-release.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 tools/make-release.sh diff --git a/tools/make-release.sh b/tools/make-release.sh new file mode 100755 index 00000000..1c065dc8 --- /dev/null +++ b/tools/make-release.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Préparation d'une release ScoDoc +# Download last git +source config.sh +source utils.sh + +usage() { + echo "Usage: $0 v9.x.y, where v9.x.y est le numéro de version créé" + exit 1 +} +if [ $# != 1 ] || [ $1 = "-h" ] || [ $1 = "--help" ] +then + usage +fi + +VERSION=$1 +SOURCE_URL="https://scodoc.org/git/viennet/ScoDoc.git" +SOURCE_BRANCH="ScoDoc8" + +# Check local diffs, ignoring file modes (changed on VMs) +local_diffs=$(git -c core.fileMode=false status --porcelain --untracked-files=no | wc -l) +if [ "$local_diffs" -ne 0 ] +then + die "you have local diffs: git commit or stash before releasing" +fi + +echo "Preparing release $VERSION" + +mkdir "/tmp/$VERSION" || die "can't create directory /tmp/$VERSION" +cd "/tmp/$VERSION" || die "can't cd /tmp/$VERSION" + +git clone "$SOURCE_URL" || die "git error cloning $SOURCE_URL" +cd ScoDoc || die "no ScoDoc directory !" +git checkout "$SOURCE_BRANCH" || die "git ckecking out branch $SOURCE_BRANCH" +# --- Create empty .../var/ subdir +mkdir -p var/scodoc || die "can't create var subdirectory" +mkdir var/scodoc/archives var/scodoc/photos var/scodoc/tmp var/scodoc/config +mkdir var/scodoc/config/version var/scodoc/config/depts var/scodoc/config/logos +cd .. +mv ScoDoc scodoc8 +chown -R scodoc scodoc8 +tar cfz "scodoc8-$VERSION.tgz" scodoc8 + +