"Fossies" - the Fresh Open Source Software Archive

Member "geoipupdate-4.3.0/dev-bin/release.sh" (16 Apr 2020, 1921 Bytes) of package /linux/misc/geoipupdate-4.3.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.

    1 #!/bin/bash
    2 
    3 set -eu -o pipefail
    4 
    5 changelog=$(cat CHANGELOG.md)
    6 
    7 
    8 if [[ -z ${GITHUB_TOKEN:-} ]]; then
    9     echo 'GITHUB_TOKEN must be set for goreleaser!'
   10     exit 1
   11 fi
   12 
   13 regex='
   14 ## ([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
   15 
   16 ((.|
   17 )*)'
   18 
   19 if [[ ! $changelog =~ $regex ]]; then
   20       echo "Could not find date line in change log!"
   21       exit 1
   22 fi
   23 
   24 version="${BASH_REMATCH[1]}"
   25 date="${BASH_REMATCH[2]}"
   26 notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^## [0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
   27 
   28 if [[ "$date" !=  $(date +"%Y-%m-%d") ]]; then
   29     echo "$date is not today!"
   30     exit 1
   31 fi
   32 
   33 if [ -n "$(git status --porcelain)" ]; then
   34     echo ". is not clean." >&2
   35     exit 1
   36 fi
   37 
   38 tag="v$version"
   39 
   40 echo $'\nRelease notes:'
   41 echo "$notes"
   42 
   43 
   44 read -p "Continue? (y/n) " ok
   45 
   46 if [ "$ok" != "y" ]; then
   47     echo "Aborting"
   48     exit 1
   49 fi
   50 
   51 echo "Creating tag $tag"
   52 
   53 message="$version
   54 
   55 $notes"
   56 
   57 git tag -a -m "$message" "$tag"
   58 
   59 # It's important to push before running any hub commands as hub works off
   60 # what's pushed.
   61 git push
   62 
   63 # goreleaser's `--rm-dist' should clear out `dist', but it didn't work for me.
   64 rm -rf dist
   65 goreleaser release --rm-dist -f .goreleaser.yml --release-notes <(echo "$message")
   66 make clean BUILDDIR=.
   67 
   68 rm -rf dist
   69 goreleaser release --rm-dist -f .goreleaser-windows.yml --skip-publish
   70 hub release edit -m "$message" \
   71     -a "dist/geoipupdate_${version}_windows_386.zip" \
   72     -a "dist/geoipupdate_${version}_windows_amd64.zip" \
   73     -a dist/checksums-windows.txt \
   74     "$tag"
   75 make clean BUILDDIR=.
   76 
   77 rm -rf dist
   78 goreleaser release --rm-dist -f .goreleaser-packages.yml --skip-publish
   79 
   80 hub release edit -m "$message" \
   81     -a dist/checksums-dpkg-rpm.txt \
   82     -a "dist/geoipupdate_${version}_linux_386.deb" \
   83     -a "dist/geoipupdate_${version}_linux_amd64.deb" \
   84     -a "dist/geoipupdate_${version}_linux_386.rpm" \
   85     -a "dist/geoipupdate_${version}_linux_amd64.rpm" \
   86     "$tag"
   87 make clean BUILDDIR=.