Created
May 6, 2024 21:37
-
-
Save SamanthaLFreeman/2bf0d5e552aad532b6917a3c9ea5a8b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# Script installs the current scaffolding version and pushes to GitHub | |
if [ -z "$1" ] | |
then | |
echo "Scaffolding version is not specified" | |
exit 2 | |
fi | |
package_version=@k2sports/nuxt3-scaffolding@$1 | |
MAGENTA='\033[0;35m' | |
RED='\033[0;31m' | |
YELLOW='\033[0;33m' | |
BLUE='\033[0;36m' | |
NOCOLOR='\033[0m' | |
# Check if tree is clean: https://stackoverflow.com/a/40535565 | |
if [[ -z $(git status -s) ]] | |
then | |
echo "${MAGENTA}------ START ------${NOCOLOR}" | |
# Pull down development | |
echo "${BLUE}Checkout and update development branch...${NOCOLOR}" | |
git checkout development | |
git pull origin development || exit 1 | |
# Install new package | |
echo "${BLUE}Installing $package_version...${NOCOLOR}" | |
npm i $package_version --save-exact | |
if [[ ! -z $(git status -s) ]] | |
then | |
git add . | |
git commit -m "$(printf "Update to ${package_version}")" | |
fi | |
# Push development branch to GitHub | |
echo "${BLUE}Pushing development to github...${NOCOLOR}" | |
git push origin development | |
echo "${MAGENTA}------ END ------${NOCOLOR}" | |
exit 0 | |
else | |
echo "${RED}ERROR: Please commit changes before running upgrade.${NOCOLOR}" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment