"Fossies" - the Fresh Open Source Software Archive

Member "ponyc-0.33.0/release.bash" (1 Nov 2019, 1863 Bytes) of package /linux/misc/ponyc-0.33.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "release.bash": 0.30.0_vs_0.31.0.

    1 #!/bin/bash
    2 
    3 set -o errexit
    4 set -o nounset
    5 
    6 verify_args() {
    7   echo "Cutting a release for version $version with commit $commit"
    8   while true; do
    9     read -rp "Is this correct (y/n)?" yn
   10     case $yn in
   11     [Yy]*) break;;
   12     [Nn]*) exit;;
   13     *) echo "Please answer y or n.";;
   14     esac
   15   done
   16 }
   17 
   18 update_version() {
   19   echo "$version" > VERSION
   20   echo "VERSION set to $version"
   21 }
   22 
   23 check_for_commit_and_push() {
   24   printf "Would you like to push CHANGELOG updates to master (y/n)? "
   25   while true; do
   26     read -r yn
   27     case $yn in
   28     [Yy]*) break;;
   29     [Nn]*) exit;;
   30     *) echo "Please answer y or n.";;
   31     esac
   32   done
   33 }
   34 
   35 if [ $# -le 2 ]; then
   36   echo "version and commit arguments required"
   37 fi
   38 
   39 set -eu
   40 version=$1
   41 commit=$2
   42 
   43 verify_args
   44 
   45 # create version release branch
   46 git checkout master
   47 git pull
   48 if ! git diff --exit-code master origin/master
   49 then
   50   echo "ERROR! There are local-only changes on branch 'master'!"
   51   exit 1
   52 fi
   53 git checkout -b "release-$version" "$commit"
   54 
   55 # update VERSION and CHANGELOG
   56 update_version
   57 changelog-tool release "$version" -e
   58 
   59 # commit VERSION and CHANGELOG updates
   60 git add CHANGELOG.md VERSION
   61 git commit -m "Prep for $version release
   62 
   63 [skip ci]"
   64 
   65 # merge into release
   66 git checkout release
   67 if ! git diff --exit-code release origin/release
   68 then
   69   echo "ERROR! There are local-only changes on branch 'release'!"
   70   exit 1
   71 fi
   72 git merge "release-$version" -m "Release $version"
   73 
   74 # tag release
   75 git tag "$version"
   76 
   77 # push to release branch
   78 git push origin release
   79 git push origin "$version"
   80 
   81 # update CHANGELOG for new entries
   82 git checkout master
   83 git merge "release-$version"
   84 changelog-tool unreleased -e
   85 
   86 # check if user wants to continue
   87 check_for_commit_and_push
   88 
   89 # commit changelog and push to master
   90 git add CHANGELOG.md
   91 git commit -m "Add unreleased section to CHANGELOG post $version release prep
   92 
   93 [skip ci]"
   94 git push origin master