Created
April 21, 2020 13:27
-
-
Save restuu/859f101213acf2be2171dbeacd080508 to your computer and use it in GitHub Desktop.
Bash script to deploy based on git diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# get package directories based on diff change from last 5 commits | |
list=$(git diff --name-only HEAD~5..HEAD . | grep -o "packages/\w*" | uniq) | |
# store root dir | |
pwd=$PWD | |
# deploy each package | |
# TODO: Deploy with timeout | |
# TODO: Build pipeline that call this bash script | |
for d in $list; do | |
cd "${pwd}/${d}" && npm run deploy || echo "[ERROR] deploying $d" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment