parent
9ec45947d1
commit
ddaf9c80e5
|
@ -1,31 +0,0 @@
|
||||||
#!/usr/local/bin/bash
|
|
||||||
# $1 = destination
|
|
||||||
|
|
||||||
repo_dir="$(pwd)"
|
|
||||||
repo_name="$(basename -s .git "$repo_dir")"
|
|
||||||
dst_dir="$1"
|
|
||||||
tmp_dir="$HOME/tmp/git/$repo_name-$(date +%s)"
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] jekyll($repo_name)"
|
|
||||||
echo "[[ Deploy ]] src: '$repo_dir'"
|
|
||||||
echo "[[ Deploy ]] dst: '$dst_dir'"
|
|
||||||
echo "[[ Deploy ]] tmp: '$tmp_dir'"
|
|
||||||
|
|
||||||
if test -e "$tmp_dir"; then
|
|
||||||
echo "[[ Deploy ]] Directory '$tmp_dir' already exists, stopping deployment."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] Creating directories '$dst_dir' and '$tmp_dir'."
|
|
||||||
mkdir -p "$dst_dir" "$tmp_dir"
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] Cloning repository at '$repo_dir' into '$tmp_dir'."
|
|
||||||
git clone "$repo_dir" "$tmp_dir"
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] Building Jekyll at '$tmp_dir' into '$dst_dir'."
|
|
||||||
jekyll build --source "$tmp_dir" --destination "$dst_dir"
|
|
||||||
chmod -R g+w "$dst_dir"
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] Deleting '$tmp_dir'"
|
|
||||||
rm -rf "$tmp_dir"
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/local/bin/bash
|
#!/usr/local/bin/bash
|
||||||
# Usage: deploy-npm [--delete-target] target
|
# Usage: deploy-npm [--delete-target] target
|
||||||
|
|
||||||
# Parse input
|
|
||||||
if [ "$1" == "--delete-target" ]; then
|
if [ "$1" == "--delete-target" ]; then
|
||||||
delete_target=1
|
delete_target=1
|
||||||
dst_dir="$2"
|
dst_dir="$2"
|
||||||
|
@ -41,7 +40,7 @@ if [ $delete_target -eq 1 ]; then
|
||||||
echo "[[ Deploy ]] Deleting then recreating '$dst_dir'."
|
echo "[[ Deploy ]] Deleting then recreating '$dst_dir'."
|
||||||
rm -rf "$dst_dir"
|
rm -rf "$dst_dir"
|
||||||
mkdir "$dst_dir"
|
mkdir "$dst_dir"
|
||||||
chmod g+w "$dst_dir/"
|
chmod g+w "$dst_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[[ Deploy ]] Copying files from '$tmp_dir/dist' to '$dst_dir'."
|
echo "[[ Deploy ]] Copying files from '$tmp_dir/dist' to '$dst_dir'."
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
#!/usr/local/bin/bash
|
#!/usr/local/bin/bash
|
||||||
# $1 = destination
|
# Usage: deploy-static [--delete-target] target
|
||||||
|
|
||||||
|
if [ "$1" == "--delete-target" ]; then
|
||||||
|
delete_target=1
|
||||||
|
dst_dir="$2"
|
||||||
|
else
|
||||||
|
delete-target=0
|
||||||
|
dst_dir="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
repo_dir="$(pwd)"
|
repo_dir="$(pwd)"
|
||||||
repo_name="$(basename -s .git "$repo_dir")"
|
repo_name="$(basename -s .git "$repo_dir")"
|
||||||
dst_dir="$1"
|
|
||||||
tmp_dir="$HOME/tmp/git/$repo_name-$(date +%s)"
|
tmp_dir="$HOME/tmp/git/$repo_name-$(date +%s)"
|
||||||
|
|
||||||
echo "[[ Deploy ]] static($repo_name)"
|
echo "[[ Deploy ]] static($repo_name)"
|
||||||
|
@ -11,6 +18,7 @@ echo "[[ Deploy ]] src: '$repo_dir'"
|
||||||
echo "[[ Deploy ]] dst: '$dst_dir'"
|
echo "[[ Deploy ]] dst: '$dst_dir'"
|
||||||
echo "[[ Deploy ]] tmp: '$tmp_dir'"
|
echo "[[ Deploy ]] tmp: '$tmp_dir'"
|
||||||
|
|
||||||
|
|
||||||
if test -e "$tmp_dir"; then
|
if test -e "$tmp_dir"; then
|
||||||
echo "[[ Deploy ]] Directory '$tmp_dir' already exists, stopping deployment."
|
echo "[[ Deploy ]] Directory '$tmp_dir' already exists, stopping deployment."
|
||||||
exit
|
exit
|
||||||
|
@ -24,9 +32,16 @@ echo "[[ Deploy ]] Cloning repository at '$repo_dir' into '$tmp_dir'."
|
||||||
git clone "$repo_dir" "$tmp_dir"
|
git clone "$repo_dir" "$tmp_dir"
|
||||||
rm -rf "$tmp_dir/.git/"
|
rm -rf "$tmp_dir/.git/"
|
||||||
|
|
||||||
|
if [ $delete_target -eq 1 ]; then
|
||||||
|
echo "[[ Deploy ]] Deleting then recreating '$dst_dir'."
|
||||||
|
rm -rf "$dst_dir"
|
||||||
|
mkdir "$dst_dir"
|
||||||
|
chmod g+w "$dst_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[[ Deploy ]] Copying files from '$tmp_dir' to '$dst_dir'."
|
echo "[[ Deploy ]] Copying files from '$tmp_dir' to '$dst_dir'."
|
||||||
|
chmod -R g+w "$tmp_dir/"
|
||||||
cp -r "$tmp_dir/" "$dst_dir"
|
cp -r "$tmp_dir/" "$dst_dir"
|
||||||
chmod -R g+w "$dst_dir"
|
|
||||||
|
|
||||||
echo "[[ Deploy ]] Deleting '$tmp_dir'."
|
echo "[[ Deploy ]] Deleting '$tmp_dir'."
|
||||||
rm -rf "$tmp_dir"
|
rm -rf "$tmp_dir"
|
||||||
|
|
Loading…
Reference in New Issue