Created
June 15, 2017 06:02
-
-
Save anonymous/998f6ca7834e3351a36ee24a1e949081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
env=$1 | |
echo begin gulp build | |
# Build required environment | |
./node_modules/gulp/bin/gulp.js build --env $env | |
# Archive the ./build folder | |
echo begin to compress the build | |
tar -zcf build_$env.tar.gz -C build . | |
# Transfer the build archive to the server | |
echo begin to transfer the build archive to the server | |
scp build_$env.tar.gz deploy@45.55.151.153:/home/deploy/build_$env.tar.gz | |
# Remove old build and extract the build archive | |
echo remove the old build and extract the new build | |
ssh deploy@45.55.151.153 "rm -r /usr/share/nginx/$env/*; tar -xzf /home/deploy/build_$env.tar.gz -C /usr/share/nginx/$env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment