Add relative directory and some echo's to deployscript

This commit is contained in:
Rien Maertens 2017-07-29 14:52:27 +02:00
parent 3b70f95e56
commit 94254df35a
No known key found for this signature in database
GPG key ID: 943CAB70C511D23C
2 changed files with 12 additions and 4 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
releases/
current/
current

View file

@ -1,17 +1,25 @@
#!/bin/bash
set -euo pipefail
declare dir=$(pwd)
declare timestamp=$(date +%Y-%m-%d_%H%M)
declare release_dir="$HOME/releases/$timestamp"
declare release_dir="$dir/releases/$timestamp"
# Pull latest revision
echo "-> Pulling latest release"
git pull
# Create release dir and copy sources to that dir
echo "-> This release will be stored in $release_dir"
mkdir -p "$release_dir"
cp -ar src/* "$release_dir"
# Link this relase to $current
rm "$HOME/current"
ln -sf "$HOME/releases/$timestamp" "$HOME/current"
echo "-> Linking $dir/current to $release_dir"
rm "$dir/current" || true # This may fail
ln -sf "$dir/releases/$timestamp" "$dir/current"
echo "-> Deployed succesfully!"