Skip to content

Instantly share code, notes, and snippets.

@Janoyan
Created February 10, 2021 10:08
Show Gist options
  • Save Janoyan/ea574c18f5f1d40cbe386f0e4abdf0a3 to your computer and use it in GitHub Desktop.
Save Janoyan/ea574c18f5f1d40cbe386f0e4abdf0a3 to your computer and use it in GitHub Desktop.
version: 2
jobs:
deploy:
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "c1:37:bf:df:a7:a1:04:7c:be:d1:46:83:9a:bf:76:73"
- run:
name: Add to known_hosts
command: "xx.xx.xx.xx >> ~/.ssh/known_hosts"
- run:
name: Create .env files
command: ./.circleci/scripts/generate-env-files.sh
- run:
name: Copy .env files
command: ./.circleci/scripts/copy-env-files.sh
- run:
name: Deploy api-users
command: |
ssh xx.xx.xx.xx \
"cd /var/www/api-users && \
git pull && \
npm run start"
test:
steps:
- checkout
- run:
name: Create .env files
command: ./.circleci/scripts/generate-env-files.sh
- run:
name: Run tests
command: npm run test
workflows:
version: 2
test_and_deploy:
jobs:
- test:
context:
- testing-api-users
- deploy:
context:
- staging-api-users
requires:
- test
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment