Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Use user env for shell scripts #141

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#!/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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -43,17 +43,18 @@ 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
echo
du -sh *

cd --

7 changes: 4 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#!/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)
declare -a TO_UPDATE=(
core/banner.go
)

Expand All @@ -28,3 +28,4 @@ git push origin v$NEW_VERSION

echo
echo "[*] All done, v$NEW_VERSION released."