feat: deploy build assets in public dir on pages branch

master
Aravinth Manivannan 2022-04-09 17:41:39 +05:30
parent 7257bf6dec
commit 9a221e3a12
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 22 additions and 0 deletions

View File

@ -5,6 +5,9 @@ default: ## Build the website
clean: ## Clean build assets
./scripts/zola.sh clean
deploy: ## Deploy build
./scripts/zola.sh deploy pages public
env: ## Download build dependencies and setup dev environement
./scripts/zola.sh install

View File

@ -36,6 +36,7 @@ USAGE:
OPTIONS:
b build build website
c clean clean dependencies and build artifacts
d deploy deploy build to branch
h help print this help menu
i install install build dependencies
u url make urls relative
@ -88,6 +89,19 @@ clean() {
echo "[*] Workspace cleaned"
}
# $1: branch name
# $2: directory containing build assets
deploy() {
cd $PROJECT_ROOT
tmp_dir=$(mktemp -d)
cp -r $2/* $tmp_dir
git checkout --orphan $1
git rm -rf .
/bin/rm -rf *
cp -r $tmp_dir/* .
git add --all && git commit -m "new deploy: $(date --iso-8601=seconds)"
}
check_arg $1
download
@ -97,6 +111,11 @@ then
elif match_arg $1 'c' 'clean'
then
clean
elif match_arg $1 'd' 'deploy'
then
check_arg $2
check_arg $3
deploy $2 $3
elif match_arg $1 'b' 'build'
then
build