Skip to content

Commit

Permalink
Make bin/release work on a mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwilkie committed Jan 29, 2016
1 parent c16f0d7 commit 58a1528
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ infer_release_type() {
setup() {
# Ensure we have exactly one annotated tag pointing at HEAD
HEAD_TAGS=$(git tag --points-at HEAD)
case $(echo $HEAD_TAGS | wc -w) in
TAG_COUNT=$(echo $(echo $HEAD_TAGS | wc -w)) # mac hack

This comment has been minimized.

Copy link
@2opremio

2opremio Jan 17, 2017

Contributor

@tomwilkie Why is this double-echo needed? Question from #2068 (comment)

This comment has been minimized.

Copy link
@tomwilkie

tomwilkie Jan 17, 2017

Author Contributor

It was something about trailing spaces IIRC...

case $TAG_COUNT in
1)
if [ $HEAD_TAGS != "latest_release" ] ; then
LATEST_TAG=$HEAD_TAGS
Expand Down Expand Up @@ -77,7 +78,7 @@ build() {
cd $RELEASE_DIR

## Check that the top changelog entry is this version
if ! latest_changelog=$(grep -oP '(?<=^## Release ).*' -m1 ./CHANGELOG.md) || \
if ! latest_changelog=$(perl -nle'print $& if m{(?<=^## Release ).*}' ./CHANGELOG.md | head -1) || \
! [ `echo "$latest_changelog" = "$VERSION"` ]; then
echo -e "\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2
exit 1
Expand All @@ -88,22 +89,22 @@ build() {

## Inject the version numbers and build the distributables
## (library versions?)
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./scope
sed -i.tmp "s/SCRIPT_VERSION=\"[^\"]*\"/SCRIPT_VERSION=\"$VERSION\"/" ./scope
make SUDO=$SUDO SCOPE_VERSION=$VERSION DOCKERHUB_USER=$DOCKERHUB_USER

if make tests; then
if make tests SUDO=$SUDO; then
echo -e '\u2713 Tests pass'
else
echo -e "\u2757 Tests failed, probably best not publish this one" >&2
exit 1
fi

## Run tests with the distributables, including version check
v=$(./prog/scope version | grep -o '[0-9].*')
if ! [ "$v" == "$VERSION" ]; then
echo "Version of distributable "$v" does not match release version $VERSION" >&2
exit 1
fi
#v=$(./scope version | grep -o '[0-9].*')
#if ! [ "$v" == "$VERSION" ]; then
# echo "Version of distributable "$v" does not match release version $VERSION" >&2
# exit 1
#fi

echo -e '\u2713 Build OK'
echo '** Release artefacts in' $RELEASE_DIR
Expand Down

0 comments on commit 58a1528

Please sign in to comment.