Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2017 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/998f6ca7834e3351a36ee24a1e949081 to your computer and use it in GitHub Desktop.
Save anonymous/998f6ca7834e3351a36ee24a1e949081 to your computer and use it in GitHub Desktop.
#!/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