From 4ea964d2d0fe42ca336e8d51958a071fa86e7bce Mon Sep 17 00:00:00 2001 From: Michel NAUD Date: Wed, 17 Feb 2021 18:43:08 +0100 Subject: [PATCH] switch project to gitflow --- README.md | 18 ++++++++++++++++++ scripts/dev/changelog.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 scripts/dev/changelog.sh diff --git a/README.md b/README.md index d725168..ef6f7e1 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,21 @@ Accès par défaut: cd website ./scripts/upgrade.sh ``` + +## Git flow + +```shell +read VERSION +git checkout develop +git pull +git flow release start ${VERSION} +./scripts/changelog.sh ${VERSION} +git add . +git commit -m ${VERSION} +git flow release publish +git flow release finish + +git push --tags +git push +git checkout master && git push +``` diff --git a/scripts/dev/changelog.sh b/scripts/dev/changelog.sh new file mode 100644 index 0000000..32871e0 --- /dev/null +++ b/scripts/dev/changelog.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e + +# merge pending CHANGELOG files into final CHANGELOG.md file +# @param $1 release version (ex: 1.2.3) +VERSION=$1 +if [[ -z "${VERSION}" ]] +then + echo "syntax: ./scripts/changelog.sh VERSION" + exit 1 +fi + +if [[ ! -f "CHANGELOG.md" ]] +then + echo "CHANGELOG.md not exists" + exit 2 +fi + +CHANGELOG_FILES=$(ls CHANGELOG?*.md) + +echo "### ${VERSION}" > CHANGELOG.md.tmp + +for entry in ${CHANGELOG_FILES} +do + # add a new line at the end of the file if it's not the case + sed -i -e '$a\' "${entry}" + echo "appending ${entry} to CHANGELOG.md" + cat "${entry}" >> CHANGELOG.md.tmp + +done + +echo "" > CHANGELOG.md.tmp +echo "keep original changes" +cat CHANGELOG.md >> CHANGELOG.md.tmp + +echo "finalize CHANGELOG" +cat CHANGELOG.md.tmp > CHANGELOG.md +rm CHANGELOG?*.md CHANGELOG.md.tmp