Feature: Added lint, version_bump and deploy scripts

This commit is contained in:
Amritanshu Agrawal 2021-01-25 13:14:17 +05:30
parent f2df28ca9c
commit e3d3179cbd
3 changed files with 61 additions and 0 deletions

26
deploy.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
cd "$parent_path" || exit
./lint.sh
if [ 1 -eq "$#" ]
then
./version_bump.sh "$1"
else
echo "No version bump"
git push
git tag --delete latest
git tag latest
git push --delete origin latest
git push --tags
fi
cd "$parent_path/docker/app" || exit
docker build --tag brewman:latest .
cd "$parent_path/docker" || exit
docker save brewman:latest | bzip2 | pv | ssh tanshu@knox.tanshu.com 'bunzip2 | sudo docker load'
ansible-playbook playbook-exp.yml
ansible-playbook playbook-hops.yml
ansible-playbook playbook-acc.yml
ansible-playbook playbook-mhl.yml

9
lint.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
cd "$parent_path/overlord" || exit
npx prettier --write src/
npx ng lint --fix
cd "$parent_path/brewman" || exit
isort brewman
black brewman
flake8 brewman

26
version_bump.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
cd "$parent_path" || exit
if [ 1 -ne "$#" ]
then
echo "Usage: `basename $0` Version: eg. 9.0.0"
exit 0
fi
sed --in-place --regexp-extended 's/"([0-9].[0-9].[0-9])"/"'"$1"'"/g' brewman/brewman/__version__.py
git add brewman/brewman/__version__.py
sed --in-place --regexp-extended 's/version = "([0-9].[0-9].[0-9])"/version = "'"$1"'"/g' brewman/pyproject.toml
git add brewman/pyproject.toml
sed --in-place --regexp-extended 's/version: '\''([0-9].[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.prod.ts
git add overlord/src/environments/environment.prod.ts
sed --in-place --regexp-extended 's/version: '\''([0-9].[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/environments/environment.ts
git add overlord/src/environments/environment.ts
sed --in-place --regexp-extended 's/"version": "([0-9].[0-9].[0-9])"/"version": "'"$1"'"/g' overlord/package.json
git add overlord/package.json
git commit -m "Version Bump v$1"
git push
git tag --delete latest
git tag latest
git tag "v$1"
git push --delete origin latest
git push --tags