diff --git a/.gitignore b/.gitignore index db5ddae..b9243b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .next -node_modules \ No newline at end of file +node_modules +.env diff --git a/scripts/update-and-deploy.sh b/scripts/update-and-deploy.sh new file mode 100755 index 0000000..cd6ec47 --- /dev/null +++ b/scripts/update-and-deploy.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# access to .env +set -o allexport; source .env; set +o allexport + +# check for vars before using +if [ -z "$APP_ID" ] || [ -z "$DIGITAL_OCEAN_API_TOKEN" ]; then + echo '' + echo 'Missing $APP_ID and $DIGITAL_OCEAN_API_TOKEN environment variables' + exit 1 +fi + +echo 'Stashing current files and checking out main' +git stash +git checkout main + +echo 'Installing latest version of' +echo '@atom-learning/components' +echo '@atom-learning/theme' +echo '@atom-learning/icons' + +yarn add @atom-learning/components @atom-learning/theme @atom-learning/icons + +echo 'Committing change and pushing to remote' +git add package.json yarn.lock +git commit -m "chore: release updated components, theme & icons" +git push + +echo 'Triggering Digital Ocean App Platform build' +curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $DIGITAL_OCEAN_API_TOKEN" "https://api.digitalocean.com/v2/apps/$APP_ID/deployments"