Last active
September 29, 2020 16:20
-
-
Save theoomoregbee/cf0e5a03fe9da5e75c9dd8b0fb27aaf3 to your computer and use it in GitHub Desktop.
Gitlab Final Script for Deploying Your App over SSH
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this... recently read up that you can actually keep common code blocks as an "anchor"
see: https://docs.gitlab.com/ee/ci/yaml/#anchors