before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
stages:
- deploy
deploy_production:
stage: deploy
script:
- echo "build project for production"
- npm i -g @angular/cli
- npm install
- ng build --prod
- echo "Deploy auf Prod"
- ssh-add <(echo "$PROD_PRIVATE_KEY")
- rsync -av "$FOLDER_TO_COPY" "$SERVER_TO_SERVE":"$PATH_TO_SERVE"
- echo "Deployed auf Prod"
environment:
name: production
only:
- master