forked from captbaritone/webamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·47 lines (33 loc) · 1.2 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# Bail on errors
set -e
cd /var/www/jordaneldredge.com/
# Generate a new directory to clone to
NEW_CLONE=repos/winamp2-js-`date +%s`
# Do the clone
echo "Cloning Winamp2-js..."
if [ -z "$HASH" ]; then
echo "Using master"
git clone --depth=1 [email protected]:captbaritone/winamp2-js.git $NEW_CLONE > /dev/null
else
git clone [email protected]:captbaritone/winamp2-js.git $NEW_CLONE > /dev/null
echo "Checking out hash $HASH"
( cd $NEW_CLONE && git checkout --quiet $HASH )
fi
echo "Installing Node requirements"
( cd $NEW_CLONE && yarn install )
echo "Run tests"
( cd $NEW_CLONE && yarn run test )
echo "Build the webpack bundle"
( cd $NEW_CLONE && CDN_URL=https://d38dnrh1liu4f5.cloudfront.net/projects/winamp2-js/ yarn run build )
echo "Cleaning up node_modules/ to save space"
( cd $NEW_CLONE && rm -r node_modules )
echo "Cleaning up coverage/ to save space"
( cd $NEW_CLONE && rm -r coverage )
PREVIOUS=$(readlink -f public_html/projects/winamp2-js)
echo "The previous build was: $PREVIOUS"
echo "Creating 'previous' link to enable reverts"
ln -snf $PREVIOUS repos/previous
echo "Linking new Winamp2-js into place"
ln -snf `pwd`/$NEW_CLONE/ public_html/projects/winamp2-js
echo "Done!"