BUILD: scripts: add an automatic mode for publish-release
Passing "-a" will make it easier to automatically create archives from tagged repositories. It doesn't ask any question and doesn't return an error when the current branch is not tagged nor if the release already exists.
This commit is contained in:
parent
600cb57450
commit
7ca88159a1
@ -8,12 +8,13 @@
|
||||
# - copies & compresses files, changelog & docs to the final destination
|
||||
# - shows a listing of the final file
|
||||
|
||||
USAGE="Usage: ${0##*/} [-y] [-b branch] [-n newver] DIR"
|
||||
USAGE="Usage: ${0##*/} [-a] [-y] [-b branch] [-n newver] DIR"
|
||||
TARGET_DIR=
|
||||
OUTPUT=
|
||||
SAYYES=
|
||||
BRANCH=
|
||||
DEVEL=
|
||||
AUTO=
|
||||
NEW=
|
||||
DIR=
|
||||
DOC=( )
|
||||
@ -34,6 +35,7 @@ quit() {
|
||||
|
||||
while [ -n "$1" -a -z "${1##-*}" ]; do
|
||||
case "$1" in
|
||||
-a) AUTO=1 ; shift ;;
|
||||
-y) SAYYES=1 ; shift ;;
|
||||
-b) BRANCH="$2" ; shift 2 ;;
|
||||
-n) NEW="$2" ; shift 2 ;;
|
||||
@ -84,13 +86,19 @@ if [ "$(git diff HEAD 2>/dev/null |wc -c)" != 0 ]; then
|
||||
die
|
||||
fi
|
||||
|
||||
if [ -z "$NEW" ]; then
|
||||
NEW="$(git describe --tags HEAD --abbrev=0)"
|
||||
NEW="${NEW#v}"
|
||||
if [ -z "$NEW" -o -n "$AUTO" ]; then
|
||||
if [ -z "$NEW" ]; then
|
||||
die "Fatal: cannot determine new version, please specify it."
|
||||
NEW="$(git describe --tags HEAD --abbrev=0)"
|
||||
NEW="${NEW#v}"
|
||||
if [ -z "$NEW" ]; then
|
||||
die "Fatal: cannot determine new version, please specify it."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(git describe --tags HEAD)" != "v$NEW" ]; then
|
||||
if [ -n "$AUTO" ]; then
|
||||
quit "Not tagged, nothing to do."
|
||||
fi
|
||||
die "Current version doesn't seem tagged, it reports $(git describe --tags "v$NEW"). Did you release it ?"
|
||||
fi
|
||||
fi
|
||||
@ -117,6 +125,10 @@ if [ -z "${NEW##*-dev*}" ]; then
|
||||
DEVEL="/devel"
|
||||
fi
|
||||
|
||||
if [ -n "$AUTO" -a -e "$TARGET_DIR/src${DEVEL}/haproxy-$NEW.tar.gz.md5" ]; then
|
||||
quit "Version $NEW Already released."
|
||||
fi
|
||||
|
||||
if ! mkdir -p "$TARGET_DIR/src$DEVEL" "$TARGET_DIR/doc"; then
|
||||
die "failed to create target directories."
|
||||
fi
|
||||
@ -129,17 +141,19 @@ case "$BRANCH" in
|
||||
*) DOC=( doc/{coding-style,intro,management,configuration,proxy-protocol,lua,SPOE}.txt ) ;;
|
||||
esac
|
||||
|
||||
echo "Ready to produce the following files in $TARGET_DIR/ :"
|
||||
echo " haproxy-$NEW.tar.gz -> src${DEVEL}/"
|
||||
echo " CHANGELOG -> src/CHANGELOG"
|
||||
echo " ${DOC[@]} -> doc/*{,.gz}"
|
||||
echo
|
||||
if [ -z "$AUTO" ]; then
|
||||
echo "Ready to produce the following files in $TARGET_DIR/ :"
|
||||
echo " haproxy-$NEW.tar.gz -> src${DEVEL}/"
|
||||
echo " CHANGELOG -> src/CHANGELOG"
|
||||
echo " ${DOC[@]} -> doc/*{,.gz}"
|
||||
echo
|
||||
|
||||
git ls-tree -l --abbrev=12 "v$NEW" -- CHANGELOG "${DOC[@]}"
|
||||
git ls-tree -l --abbrev=12 "v$NEW" -- CHANGELOG "${DOC[@]}"
|
||||
|
||||
if [ -z "$SAYYES" ]; then
|
||||
echo "Press ENTER to continue or Ctrl-C to abort now!"
|
||||
read
|
||||
if [ -z "$SAYYES" ]; then
|
||||
echo "Press ENTER to continue or Ctrl-C to abort now!"
|
||||
read
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Archiving sources for version $NEW ..."
|
||||
|
Loading…
x
Reference in New Issue
Block a user