Skip to content

Instantly share code, notes, and snippets.

@guleriagishere
Last active February 15, 2021 14:10
Show Gist options
  • Save guleriagishere/411303ad33e3dc0f6a36910c4181f6c3 to your computer and use it in GitHub Desktop.
Save guleriagishere/411303ad33e3dc0f6a36910c4181f6c3 to your computer and use it in GitHub Desktop.
random bash script
#!/bin/bash
SUBDOMAIN_SUFFIX=$1
REGION=$2
# Get list of directories modified in current commit.
LIST_OF_DIRS=$(git diff --dirstat=files,0 HEAD~1 | awk '{print $2}' | cut -d '/' -f 1 | uniq)
CURR_DIR=$(echo $(pwd))
for i in $LIST_OF_DIRS
do
cd $CURR_DIR
cd $i
echo "current dir is $(pwd)"
echo $SUBDOMAIN_SUFFIX
npm install
npm run build
S3_BUCKET=$i-$SUBDOMAIN_SUFFIX
aws s3 cp build s3://$S3_BUCKET/ --recursive --region $REGION
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment