diff --git a/composer.json b/composer.json index 2908283..d541d7e 100644 --- a/composer.json +++ b/composer.json @@ -156,6 +156,7 @@ "drupal/drupal-extension": "^5.0" }, "scripts": { - "build-fe": "cd web/themes/custom/dchadwick && npm ci && npm run compile" + "build-fe": "cd web/themes/custom/dchadwick && npm ci && npm run compile", + "deploy": "sh scripts/deploy.sh" } } diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..c3447fa --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +DESTINATION_BRANCH='main' +LOCAL_REPO='/Users/danchadwick/Sites/dchadwick' +echo "Building artifact and deploying to $DESTINATION_BRANCH\n" + +# Remove any old builds. +rm -rf /tmp/builds +mkdir /tmp/builds +# Move into build directory and create artifact. +cd /tmp/builds +git clone root@64.23.158.41:/var/repo/repository.git -b main dchadwick +cd dchadwick +echo "Copying local repo to build dir\n" +rsync -av --exclude-from="$LOCAL_REPO/scripts/rsync-exclude.txt" $LOCAL_REPO/ . +composer install --no-dev --prefer-dist --no-interaction +find . -mindepth 2 -type d -name ".git" -exec rm -rf {} + +git add -A +git commit -m "Automated Artifact Build." +git push origin $DESTINATION_BRANCH --dry-run diff --git a/scripts/rsync-exclude.txt b/scripts/rsync-exclude.txt new file mode 100644 index 0000000..1be95c8 --- /dev/null +++ b/scripts/rsync-exclude.txt @@ -0,0 +1,15 @@ +.ddev +.phpunit.cache +.git +.gitmodules +.git/modules/* +sites/default/files +private-files +vendor +node_modules +tmp +web/core +web/modules/contrib +web/themes/contrib +web/sites/simpletest +web/profiles/contrib