Skip to content

Commit 5f018f0

Browse files
committed
Setup auto deployment via CircleCI #19
1 parent a66e4b3 commit 5f018f0

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

.circleci/config.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
# List of jobs
44
jobs:
55
# The build and test job
6-
build_and_test:
6+
build-test:
77
working_directory: ~/angular-universal
88
docker:
99
- image: circleci/node:8.9.0-browsers
@@ -54,10 +54,32 @@ jobs:
5454
- run:
5555
name: Unit Testing
5656
command: cd project/application && npm run test -- --watch=false
57+
# The deploy job
58+
deploy:
59+
machine:
60+
enabled: true
61+
environment:
62+
FINGERPRINT: 8c:c8:d3:84:56:47:d7:28:13:2a:d8:2b:4e:53:0e:c0
63+
SSH_USER: la
64+
SSH_HOST: angular-universal.lazy-ants.com
65+
steps:
66+
- add_ssh_keys:
67+
fingerprints:
68+
- "$FINGERPRINT" #https://circleci.com/docs/2.0/add-ssh-key
69+
- run:
70+
name: Deploy Over SSH
71+
command: |
72+
ssh $SSH_USER@$SSH_HOST "cd /var/www/angular-universal && bash deploy-circleci.sh"
5773
5874
workflows:
5975
version: 2
60-
# The build and test
61-
build_and_test:
76+
# The build, test and deploy
77+
build-test_deploy:
6278
jobs:
63-
- build_and_test
79+
- build-test
80+
- deploy:
81+
requires:
82+
- build-test
83+
filters:
84+
branches:
85+
only: master

deploy-circleci.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
echo 'Before checkout'
2+
git status
3+
git checkout -- .
4+
echo 'After checkout'
5+
git pull origin master
6+
docker-compose up -d --build
7+
docker exec -i angular-universal_nodejs npm install
8+
docker exec -i angular-universal_nodejs bash -c 'npm run build:ssr'
9+
docker exec -i angular-universal_nodejs bash -c 'npm run serve:ssr'

deploy.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)