From 6f698bfaf6716ba0301270ba3eb9dce9312f2780 Mon Sep 17 00:00:00 2001 From: Joseph Milla Date: Thu, 5 Jul 2018 12:08:17 -0700 Subject: [PATCH 1/5] Use /usr/bin/env instead of just /bin --- build.sh | 2 +- release.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4fb28a58..fbb46d3b 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash BUILD_FOLDER=build VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) diff --git a/release.sh b/release.sh index c9795f00..c203376e 100755 --- a/release.sh +++ b/release.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash CURRENT_VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) TO_UPDATE=( From 0c69ae09f36f27b77df5a8b8d402d2d3212cbeb4 Mon Sep 17 00:00:00 2001 From: Joseph Milla Date: Thu, 5 Jul 2018 12:08:33 -0700 Subject: [PATCH 2/5] Use readonly for constant variables --- build.sh | 4 ++-- release.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index fbb46d3b..cfeea24d 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -BUILD_FOLDER=build -VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) +readonly BUILD_FOLDER=build +readonly VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) bin_dep() { BIN=$1 diff --git a/release.sh b/release.sh index c203376e..2d76e512 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -CURRENT_VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) TO_UPDATE=( +readonly CURRENT_VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) core/banner.go ) From 9238f68b6cecb52a7a0e0c6003fda569bafd2113 Mon Sep 17 00:00:00 2001 From: Joseph Milla Date: Thu, 5 Jul 2018 12:09:09 -0700 Subject: [PATCH 3/5] Use quotation marks when using variables --- build.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index cfeea24d..0c70400c 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ bin_dep() { create_exe_archive() { bin_dep 'zip' - OUTPUT=$1 + OUTPUT="$1" echo "[*] Creating archive $OUTPUT ..." zip -j "$OUTPUT" gitrob.exe ../README.md ../LICENSE.txt > /dev/null @@ -21,7 +21,7 @@ create_exe_archive() { create_archive() { bin_dep 'zip' - OUTPUT=$1 + OUTPUT="$1" echo "[*] Creating archive $OUTPUT ..." zip -j "$OUTPUT" gitrob ../README.md ../LICENSE.md > /dev/null @@ -43,13 +43,13 @@ build_windows_amd64() { GOOS=windows GOARCH=amd64 go build -o gitrob.exe .. } -rm -rf $BUILD_FOLDER -mkdir $BUILD_FOLDER -cd $BUILD_FOLDER +rm -rf "$BUILD_FOLDER" +mkdir "$BUILD_FOLDER" +cd "$BUILD_FOLDER" -build_linux_amd64 && create_archive gitrob_linux_amd64_$VERSION.zip -build_macos_amd64 && create_archive gitrob_macos_amd64_$VERSION.zip -build_windows_amd64 && create_exe_archive gitrob_windows_amd64_$VERSION.zip +build_linux_amd64 && create_archive "gitrob_linux_amd64_$VERSION.zip" +build_macos_amd64 && create_archive "gitrob_macos_amd64_$VERSION.zip" +build_windows_amd64 && create_exe_archive "gitrob_windows_amd64_$VERSION.zip" shasum -a 256 * > checksums.txt echo From e32ac9cc7319a56cec66009b77f44f5627988929 Mon Sep 17 00:00:00 2001 From: Joseph Milla Date: Thu, 5 Jul 2018 12:09:28 -0700 Subject: [PATCH 4/5] Add newline at EOF --- build.sh | 1 + release.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/build.sh b/build.sh index 0c70400c..b202827e 100755 --- a/build.sh +++ b/build.sh @@ -57,3 +57,4 @@ echo du -sh * cd -- + diff --git a/release.sh b/release.sh index 2d76e512..b428596e 100755 --- a/release.sh +++ b/release.sh @@ -28,3 +28,4 @@ git push origin v$NEW_VERSION echo echo "[*] All done, v$NEW_VERSION released." + From db92232b34af85c21e4c4ea6a5dac595f68278c0 Mon Sep 17 00:00:00 2001 From: Joseph Milla Date: Thu, 5 Jul 2018 12:09:53 -0700 Subject: [PATCH 5/5] Use "declare -a" for arrays --- release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.sh b/release.sh index b428596e..c810f3b0 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -TO_UPDATE=( readonly CURRENT_VERSION=$(cat core/banner.go | grep Version | cut -d '"' -f 2) +declare -a TO_UPDATE=( core/banner.go )