ScoDoc/tools/make-release.sh

77 lines
1.6 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# INUTILE
2021-08-02 10:34:28 +02:00
XXX
# Préparation d'une release ScoDoc
# Download last git
source config.sh
source utils.sh
usage() {
2021-07-23 14:46:12 +02:00
echo $1 >&2
echo "Usage: $0 [-f] -v 9.x.y, where 9.x.y est le numéro de version créé" >&2
echo " -f: force release even if there's local changes" >&2
exit 1
}
2021-07-23 14:46:12 +02:00
FORCE_RELEASE=0
while getopts "hfv:" opt; do
case $opt in
f)
FORCE_RELEASE=1
;;
v)
VERSION=$OPTARG
;;
h)
usage "Prépare une release"
;;
\?)
usage "Invalid option: -$OPTARG"
;;
:)
usage "Option -$OPTARG requires an argument."
;;
esac
done
if [ -z "$VERSION" ]
then
usage
fi
SOURCE_URL="https://scodoc.org/git/viennet/ScoDoc.git"
SOURCE_BRANCH="ScoDoc8"
2021-07-23 14:46:12 +02:00
RESULTFILE="scodoc-$VERSION.tgz"
2021-07-23 14:46:12 +02:00
if [ "$FORCE_RELEASE" -eq 0 ]
then
2021-07-23 14:46:12 +02:00
# 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
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"
2021-07-23 14:46:12 +02:00
cd ..
2021-07-23 14:46:12 +02:00
# --- Archive
echo "Preparing archive..."
mv ScoDoc scodoc
chown -R scodoc scodoc
tar cfz "$RESULTFILE" scodoc
2021-07-23 14:46:12 +02:00
echo
echo "Release: $(pwd)/$RESULTFILE"