Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
k9ert committed Oct 17, 2022
2 parents 7c7b41f + bd8102a commit 1ca488a
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions utils/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ case $key in
command=wait_on_master
shift
;;
--help)
help
shift
exit 0
;;
--release-notes)
RELEASE_NOTES="yes"
shift # past value
Expand Down Expand Up @@ -61,6 +66,11 @@ case $key in
esac
done

function help() {
# echo HERE_DOC
# ...
echo "not yet implemented"
}

function main() {
# Sed is used as there can be whitespaces
Expand All @@ -74,27 +84,18 @@ function main() {
echo " --> You don't have a reasonable origin-remote. You need this to release (especially with --dev). Please add one!"
exit 2
fi

echo " --> Fetching all tags ..."
git fetch upstream --tags


current_branch=$(git rev-parse --abbrev-ref HEAD)

if [ "$current_branch" != "master" ]; then
echo "You're currently not on the master-branch, so we assume this will get a PR"
git fetch upstream master
PR_MODE=yes
if ! git diff master..${current_branch} --exit-code > /dev/null; then
echo "You current branch is also not similiar to master."
echo "should i merge master?"
if ! ask_yn ; then
echo "break"
exit 2
fi
git merge master
fi
echo "You're currently not on the master-branch, exiting"
exit 2
fi

echo " --> Fetching all tags ..."
git fetch upstream --tags
echo " --> git pull upstream master"
git pull upstream master

if [[ -z "$new_version" ]]; then
echo "What should be the new version? Type in please (e.g. v0.9.3 ):"
read new_version
Expand All @@ -116,10 +117,7 @@ function main() {

latest_version=$(git tag -l "v*" | grep -v 'pre' | grep -v 'dev' | sort -V | tail -1)

echo "latest_version is $latest_version. "

echo " --> The latest version is $latest_version. "
echo " --> We'll create the release-notes based on that."
if ! ask_yn ; then
echo "Ok, then you type in the latest_version:"
read latest_version
Expand All @@ -135,34 +133,35 @@ function main() {
echo "" >> docs/new_release_notes.md
echo "## ${new_version} $(date +'%B %d, %Y')" >> docs/new_release_notes.md
docker run registry.gitlab.com/cryptoadvance/specter-desktop/github-changelog:latest --github-token $GH_TOKEN --branch master cryptoadvance specter-desktop $latest_version | sort >> docs/new_release_notes.md
echo "" >> docs/new_release_notes.md


cat docs/new_release_notes.md
echo "--------------------------------------------------"

cp docs/release-notes.md docs/release-notes.md.orig
sed -i '1,2d/' docs/release-notes.md.orig # Assuming the release-Notes start with # Release Notes\n
sed -i -e '1,2d' docs/release-notes.md.orig # Assuming the release-Notes start with # Release Notes\n
cat docs/new_release_notes.md docs/release-notes.md.orig > docs/release-notes.md
rm docs/release-notes.md.orig docs/new_release_notes.md

echo "Please check your new File and modify as you find approriate!"
echo "We're waiting here ..."

echo " --> Should we commit and push that (to origin) now? "
echo " --> Should we create a PR-branch now? "

if ! ask_yn ; then
echo "break"
echo "Rolling back release_notes.md ..."
git checkout docs/release-notes.md
#git checkout docs/release-notes.md
exit 2
fi

echo " --> Creating branch ${new_version}_release_notes "
git checkout -b ${new_version}_release_notes
git add docs/release-notes.md
git commit -m "adding release_notes to $new_version"
git push origin
git commit -m "adding release_notes for $new_version"
git push --set-upstream origin ${new_version}_release_notes

echo "Now go ahead and make your PR:"
echo "https://github.com/cryptoadvance/specter-desktop/compare"
echo "https://github.com/cryptoadvance/specter-desktop/pulls"
exit 0
fi

Expand Down

0 comments on commit 1ca488a

Please sign in to comment.