-
Notifications
You must be signed in to change notification settings - Fork 35
/
.gitlab-ci.yml
67 lines (60 loc) · 2.2 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
variables:
DEPLOY_FOLDER: "resourcecalculator.com"
DEV_DEPLOY_FOLDER: "beta.resourcecalculator.com"
stages:
- build
# - test
- deploy
build-site:
image: asherglick/webbuild:20240727
stage: build
script:
- pip3 install -r requirements.txt
- npm install
# Build System Website
- python3 build.py
artifacts:
paths:
- output
# Expire after 1 hour
expire_in: 1 hr
deploy-prod:
image: asherglick/webdeploy:20170802
stage: deploy
script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in the environment to the agent store
- ssh-add <(echo "$PROD_SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are susceptible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh $PROD_USER@$PROD_HOST ls
# Sync over the files
- rsync --recursive --archive --verbose -e ssh --delete output/ $PROD_USER@$PROD_HOST:/home/$PROD_USER/$DEPLOY_FOLDER/
- ssh $PROD_USER@$PROD_HOST "cd $DEPLOY_FOLDER; tree -a"
only:
- production
deploy-dev:
image: asherglick/webdeploy:20170802
stage: deploy
script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in the environment to the agent store
- ssh-add <(echo "$DEV_SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are susceptible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh $DEV_USER@$DEV_HOST ls
# Sync over the files
- rsync --recursive --archive --verbose -e ssh --delete output/ $DEV_USER@$DEV_HOST:/home/$DEV_USER/$DEV_DEPLOY_FOLDER/
- ssh $DEV_USER@$DEV_HOST "cd $DEV_DEPLOY_FOLDER; tree -a"
only:
- master