Created
October 10, 2019 14:57
-
-
Save patleeman/a4636cb0506e6ee682014dbc4a747030 to your computer and use it in GitHub Desktop.
Example build script for project Meristem.
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 git fetch match pattern to fetch all branches. | |
# If this isn't set, running git fetch may not pull all the branches we need. | |
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" | |
git clone ${REPO_URL} tmp/ | |
cd tmp/ | |
git fetch --all | |
# Stop the script if something breaks during checkout. i.e. SHA wasn't pushed to origin. | |
if ! git checkout ${baseline_branch}; then | |
exit 1 | |
fi | |
cd .. | |
cp -r tmp/ build/ | |
# jq is a json processing utility https://stedolan.github.io/jq/ | |
for row in $(echo "${variations}" | jq -c '.[]'); do | |
name=$(echo ${row} | jq -r '.name') | |
sha=$(echo ${row} | jq -r '.sha') | |
cd tmp/ | |
if ! git checkout ${sha}; then | |
exit 1 | |
fi | |
cd .. | |
cp -r tmp/src/flows/baseline build/src/flows/${name} | |
done | |
cd build | |
npm ci | |
npm run build | |
cd .. | |
# Move the built assets into this repo's dist folder and clean up. | |
mv build/dist . | |
rm -rf build/ | |
rm -rf tmp/ | |
echo "Build complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment