always remove tmpdir in deploy.sh (#530)
continuous-integration/drone/push Build is passing Details

This change ensures that the temporary directory created by `mkdir --directory` is always removed when `deploy.sh` exits, whether or not the script succeeded.

It also modifies the `git clone` command to use the `file://` protocol instead of HTTPS, to speed up the download.

Reviewed-on: #530
Reviewed-by: Shahan Nedadahandeh <snedadah@csclub.uwaterloo.ca>
Co-authored-by: Max Erenberg <merenber@csclub.uwaterloo.ca>
Co-committed-by: Max Erenberg <merenber@csclub.uwaterloo.ca>
This commit is contained in:
Max Erenberg 2022-11-27 15:00:07 -05:00 committed by Shahan Nedadahandeh
parent 3fe5696dd1
commit 7e5466e2bc
1 changed files with 3 additions and 3 deletions

View File

@ -4,12 +4,14 @@ set -ex
ulimit -u 512
DIR=$(mktemp --directory)
trap "rm -rf $DIR" EXIT
# set USE_LDAP to true to generate member list using LDAP database
export USE_LDAP=true
pushd $DIR
git clone https://git.csclub.uwaterloo.ca/www/www-new.git --depth=1
git clone file:///srv/git/www/www-new.git --depth=1
cd www-new
@ -26,5 +28,3 @@ rm -rf /srv/www-csc/*
mv out/* /srv/www-csc/
popd
rm -rf $DIR