image: node:12.16.3 stages: - tests - deploy before_script: - apt-get update -qq run_tests: stage: tests script: # - npm i npm@latest -g # this can be commented back in later, at the moment this takes > 30s - npm i - npm run test-with-coverage - npx nyc report --reporter=text-summary coverage: '/Statements.*?(\d+(?:\.\d+)?)%/' artifacts: when: always paths: # save coverage results - coverage expire_in: 10 days only: - master deploy_dev: stage: deploy before_script: - echo "I am preparing to copy the SSH key" # Setup SSH deploy keys - 'which ssh-agent || ( apt-get install -qq openssh-client )' - eval $(ssh-agent -s) - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' environment: name: dev url: dev.22d2.net script: - ssh [USER]@[SERVER-HOST] "sh dev-deploy.sh" only: - master deploy_prod: stage: deploy before_script: - echo "I am preparing to copy the SSH key" # Setup SSH deploy keys - 'which ssh-agent || ( apt-get install -qq openssh-client )' - eval $(ssh-agent -s) - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' environment: name: production url: 22d2.net script: - ssh [USER]@[SERVER-HOST] "sh prod-deploy.sh" only: - release/production