-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.73 KB
/
deploy.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
name: Deploy to Server
on:
push:
branches:
- main
pull_request:
types:
- closed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make envfile
id: envfile
uses: SpicyPizza/[email protected]
with:
envkey_COMPOSE_PROJECT_NAME: ${{ secrets.COMPOSE_PROJECT_NAME }}
envkey_CN: ${{ secrets.CN }}
envkey_DIN: ${{ secrets.DIN }}
envkey_DIV: ${{ secrets.DIV }}
envkey_DLU: ${{ secrets.DLU }}
envkey_DLP: ${{ secrets.DLP }}
envkey_DCF: ${{ secrets.DCF }}
envkey_ED: ${{ secrets.ED }}
envkey_EP: ${{ secrets.EP }}
envkey_EF: ${{ secrets.EF }}
envkey_REPO: ${{ secrets.REPO }}
directory: ops
file_name: .env.prod
fail_on_empty: false
sort_keys: false
- name: Build and push Docker image
env:
DLU: ${{ secrets.DLU }}
DLP: ${{ secrets.DLP }}
DIN: ${{ secrets.DIN}}
DIV: ${{ secrets.DIV}}
run: |
docker build -t $DIN:$DIV .
echo $DLP | docker login -u $DLU --password-stdin
docker push $DIN:$DIV
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: SSH into the server and run the app
run: |
# Copy .env.prod to the deploy server
scp -o "StrictHostKeyChecking=no" -r ops/.env.prod [email protected]:/var/docker/dclm-dtc/ops
# Deploy new app
ssh -o "StrictHostKeyChecking=no" [email protected] "cd /var/docker/dclm-dtc && make new && make down && make up"