Skip to content

Commit

Permalink
fix: removed direct references of unix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsuguimoto committed Jul 2, 2022
1 parent a713943 commit 57a0342
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[{.*yaml,*.yml}]
[{*.yaml,*.yml,*.sh}]
indent_style = space
indent_size = 2
47 changes: 27 additions & 20 deletions build_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,29 @@ while [ $# -gt 0 ]; do
done

if [ -f .env ]; then
source .env
source .env
fi

GO_IMAGE=${GO_IMAGE:-golang:1.18}

if [ "$BUILD_VERSION" == "" ]; then
echo "missing environment variable BUILD_VERSION"
exit 5
echo "missing environment variable BUILD_VERSION"
exit 5
fi

read -p "You are going to build all artifacts for version $BUILD_VERSION. Continue? (y/N) "
if [[ ! $REPLY =~ ^(yes|YES|y|Y)$ ]]
then
exit
exit
fi

rm -rf dist
mkdir -p dist
docker run --rm -i \
-v $(pwd):/work -w /work \
kooldev/bash -c 'rm -rf dist'

docker run --rm -i \
-v $(pwd):/work -w /work \
kooldev/bash -c 'mkdir -p dist'

# ATTENTION - binary names must match the -GOOS-GOARCH suffix
# because self-update relies on this pattern to work.
Expand All @@ -50,31 +55,33 @@ BUILD=(\
)

for i in "${!BUILD[@]}"; do
dist=$(echo ${BUILD[$i]} | cut -d'|' -f1)
flags=$(echo ${BUILD[$i]} | cut -d'|' -f2)
echo "Building to ${flags}"
docker run --rm \
$flags \
--env CGO_ENABLED=0 \
-v $(pwd):/code -w /code $GO_IMAGE \
go build -a -tags 'osusergo netgo static_build' \
-ldflags '-X kool-dev/kool/commands.version='$BUILD_VERSION' -extldflags "-static"' \
-o $dist
dist=$(echo ${BUILD[$i]} | cut -d'|' -f1)
flags=$(echo ${BUILD[$i]} | cut -d'|' -f2)
echo "Building to ${flags}"
docker run --rm \
$flags \
--env CGO_ENABLED=0 \
-v $(pwd):/code -w /code $GO_IMAGE \
go build -a -tags 'osusergo netgo static_build' \
-ldflags '-X kool-dev/kool/commands.version='$BUILD_VERSION' -extldflags "-static"' \
-o $dist
done

echo "Building kool-install.exe"

cp dist/kool-windows-amd64.exe dist/kool.exe
docker run --rm -i \
-v $(pwd):/work -w /work \
kooldev/bash -c 'cp dist/kool-windows-amd64.exe dist/kool.exe'

docker run --rm -i \
-v $(pwd):/work \
amake/innosetup /dApplicationVersion=$BUILD_VERSION inno-setup/kool.iss
-v $(pwd):/work -w /work \
amake/innosetup /dApplicationVersion=$BUILD_VERSION inno-setup/kool.iss
mv inno-setup/Output/mysetup.exe dist/kool-install.exe

echo "Going to generate CHECKSUMS"

for file in dist/*; do
shasum -a 256 $file > $file.sha256
shasum -a 256 $file > $file.sha256
done

echo "Finished building all artifacts for version $BUILD_VERSION"
2 changes: 1 addition & 1 deletion docs/1-Getting-Started/3-How-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ scripts:
- kool run node-setup

setup:
- cp .env.example .env
- kool docker kooldev/bash -c "cp .env.example .env"
- kool start
- kool run composer install
- kool run artisan key:generate
Expand Down
2 changes: 1 addition & 1 deletion docs/1-Getting-Started/4-Starting-new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ scripts:
- kool run yarn dev

setup:
- cp .env.example .env
- kool docker kooldev/bash -c "cp .env.example .env"
- kool start
- kool run composer install
- kool run node-setup
Expand Down
2 changes: 1 addition & 1 deletion docs/2-Presets/CodeIgniter.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ scripts:
phpunit: kool exec app php ./bin/phpunit

setup:
- cp env .env
- kool docker kooldev/bash -c "cp env .env"
- kool start
- kool run composer install
- kool run spark key:generate
Expand Down
2 changes: 1 addition & 1 deletion docs/2-Presets/Laravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ scripts:
- kool run node-setup

setup:
- cp .env.example .env
- kool docker kooldev/bash -c "cp .env.example .env"
- kool start
- kool run composer install
- kool run artisan key:generate
Expand Down
8 changes: 4 additions & 4 deletions make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ kool run lint
kool run test

if [ ! -z "$(git status -s)" ]; then
echo "You have uncommited changes; aborting creating release."
exit 1
echo "You have uncommited changes; aborting creating release."
exit 1
fi

read -p "What version do you want to build (0.0.0 semver format): "
if [[ ! $REPLY =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "Bad version format; expected semver 0.0.0"
exit 1
echo "Bad version format; expected semver 0.0.0"
exit 1
fi

export BUILD_VERSION=$REPLY
Expand Down
2 changes: 1 addition & 1 deletion presets/codeigniter/codeigniter-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scripts:
mysql: kool exec -e MYSQL_PWD=$DB_PASSWORD database mysql -uroot

setup:
- cp env .env
- kool docker kooldev/bash -c "cp env .env"
- kool start
- kool run composer install
- kool run spark key:generate
Expand Down
2 changes: 1 addition & 1 deletion presets/laravel/laravel-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ scripts:

# Use this to setup your projects the first in a new environment.
setup:
- cp .env.example .env
- kool docker kooldev/bash -c "cp .env.example .env"
- kool start
- kool run composer install
- kool run artisan key:generate
Expand Down
2 changes: 1 addition & 1 deletion templates/scripts/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scripts:
phpunit: kool exec app php ./bin/phpunit

setup:
- cp .env.example .env
- kool docker kooldev/bash -c "cp .env.example .env"
- kool start
- kool run composer install
- kool run artisan key:generate
Expand Down

0 comments on commit 57a0342

Please sign in to comment.