feat: deploy build assets in public dir on pages branch
parent
7257bf6dec
commit
9a221e3a12
3
Makefile
3
Makefile
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue