neilhanlon.me/deploy.sh

35 lines
808 B
Bash
Raw Permalink Normal View History

2022-11-11 21:14:34 +00:00
#!/bin/bash -ex
2022-11-12 03:41:13 +00:00
export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME}"
export GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL}"
2022-11-12 13:01:54 +00:00
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
2022-11-12 03:41:13 +00:00
2022-11-12 12:52:50 +00:00
REMOTE="${PUSH_REMOTE:-git@git.shrug.pw:neil/neilhanlon.me.git}"
2022-11-11 21:14:34 +00:00
rm -fr pages.git
mkdir pages.git
( cd pages.git && git init -b pages )
rsync -av public/* pages.git
cat << EOF > pages.git/.domains
neilhanlon.me
neilhanlon.com
hanlon.ninja
thepotato.tech
EOF
cd pages.git
2022-11-12 13:01:54 +00:00
set -x
2022-11-12 03:45:15 +00:00
git config user.name "$GIT_AUTHOR_NAME"
git config user.email "$GIT_AUTHOR_EMAIL"
2022-11-11 21:14:34 +00:00
git add -A
git commit -m "Deployment at $(date -u -Is)"
git remote add origin $REMOTE
git push -f origin pages
2023-04-03 01:33:22 +00:00
curl -X POST --fail \
2023-04-03 01:38:44 +00:00
-F token=$GITLAB_DEPLOY_TOKEN \
2023-04-03 01:33:22 +00:00
-F ref=main \
https://gitlab.com/api/v4/projects/29559707/trigger/pipeline