2023-09-26 09:16:39 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-07-15 16:49:46 +00:00
|
|
|
|
2023-10-08 02:09:10 +00:00
|
|
|
PRIVATE_SSH_KEY=${PRIVATE_SSH_KEY:-"/run/secrets/passwordless"}
|
2023-07-15 16:49:46 +00:00
|
|
|
SOURCEHUT_USERNAME=${SOURCEHUT_PAGES_SUBDOMAIN:-"ajhalili2006"}
|
2023-10-08 02:09:10 +00:00
|
|
|
SOURCEHUT_PAGES_TOKEN=${SOURCEHUT_PAGES_TOKEN}
|
2023-07-15 16:49:46 +00:00
|
|
|
GEMINI_CUSTOM_DOMAIN=${GEMINI_CUSTOM_DOMAIN:-"gemini.andreijiroh.eu.org"}
|
|
|
|
|
|
|
|
if [[ $SOURCEHUT_PAGES_TOKEN == "" ]]; then
|
|
|
|
echo "missing SOURCEHUT_PAGES_TOKEN variable"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-07-15 17:40:48 +00:00
|
|
|
mkdir "gmi/api"
|
|
|
|
git rev-parse HEAD > "gmi/api/commit"
|
2023-10-01 00:33:49 +00:00
|
|
|
tar -C gmi -cvz . -f gemini-site.tar.gz
|
2023-07-15 16:49:46 +00:00
|
|
|
|
|
|
|
curl --oauth2-bearer "$SOURCEHUT_PAGES_TOKEN" \
|
2023-10-07 03:23:56 +00:00
|
|
|
-Fcontent=@gemini-site.tar.gz \
|
2023-07-15 16:49:46 +00:00
|
|
|
-Fprotocol=GEMINI \
|
|
|
|
"https://pages.sr.ht/publish/${SOURCEHUT_USERNAME}.srht.site"
|
|
|
|
curl --oauth2-bearer "$SOURCEHUT_PAGES_TOKEN" \
|
2023-10-07 03:23:56 +00:00
|
|
|
-Fcontent=@gemini-site.tar.gz \
|
2023-07-15 16:49:46 +00:00
|
|
|
-Fprotocol=GEMINI \
|
2023-10-01 00:33:49 +00:00
|
|
|
"https://pages.sr.ht/publish/${GEMINI_CUSTOM_DOMAIN}"
|
2023-10-08 02:09:10 +00:00
|
|
|
|
|
|
|
rsync -rP -e "ssh -i ${PRIVATE_SSH_KEY} -o StrictHostKeyChecking=no" gmi/ ajhalili2006@p.projectsegfau.lt:/home/ajhalili2006/public_gemini
|
|
|
|
rsync -rP -e "ssh -i ${PRIVATE_SSH_KEY} -o StrictHostKeyChecking=no" gmi/ ajhalili2006@s1.dimension.sh:/home/ajhalili2006/public_gemini
|