Documentation/deploy.sh
2021-11-17 00:01:14 +01:00

14 lines
607 B
Bash
Executable file

#!/bin/bash -ex
npm run build
REPO=${1:-git@codeberg.org:docs/pages}
rm -rf pages.git
git clone $REPO pages.git
rsync -av _site/* pages.git/
( cd pages.git && git checkout --orphan current ) ## create new branch at origin
( cd pages.git && git add -A ) ## add all generated files
( cd pages.git && git commit -am "Deployment at $(date -u -Is)" ) ## commit all
( cd pages.git && git branch -D main ) ## delete old main branch incl. history
( cd pages.git && git branch -m main ) ## rename current branch to main
( cd pages.git && git push -f origin main ) ## force-push and rewrite (empty) history