Skip to content

Instantly share code, notes, and snippets.

@theoomoregbee
Last active September 29, 2020 16:20
Show Gist options
  • Save theoomoregbee/cf0e5a03fe9da5e75c9dd8b0fb27aaf3 to your computer and use it in GitHub Desktop.
Save theoomoregbee/cf0e5a03fe9da5e75c9dd8b0fb27aaf3 to your computer and use it in GitHub Desktop.
Gitlab Final Script for Deploying Your App over SSH
image: trion/ng-cli-karma
cache:
paths:
- node_modules/
before_script:
- apt-get update -qq && apt-get install -y -qq sshpass
deploy_stage:
stage: deploy
environment: Staging
only:
- master
script:
- rm ./package-lock.json
- npm install
- ./node_modules/@angular/cli/bin/ng test --progress false --single-run=true --watch=false
- ./node_modules/@angular/cli/bin/ng e2e --progress false --watch=false
- ./node_modules/@angular/cli/bin/ng build --progress false --prod
- cd dist/
- ls
- sshpass -V
- export SSHPASS=$USER_PASS
- sshpass -e scp -o stricthostkeychecking=no -r . username@host.com:/var/www/html
deploy_production:
stage: deploy
environment: Production
only:
- tags
script:
- rm ./package-lock.json
- npm install
- ./node_modules/@angular/cli/bin/ng test --progress false --single-run=true --watch=false
- ./node_modules/@angular/cli/bin/ng e2e --progress false --watch=false
- ./node_modules/@angular/cli/bin/ng build --progress false --prod
- cd dist/
- ls
- sshpass -V
- export SSHPASS=$USER_PASS
- sshpass -e scp -o stricthostkeychecking=no -r . username@host.com:/var/www/html
@theoomoregbee
Copy link
Author

ah, nice thanks @craigiswayne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment