-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1 KB
/
ec2.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
name: Continuous Integration
on:
push:
branches:
- main
concurrency:
group: main
cancel-in-progress: true
jobs:
quality-assurance:
name: Run Tests
uses: ./.github/workflows/pytest.yml
deploy:
name: Deploy
needs: quality-assurance
runs-on: ubuntu-latest
steps:
- name: Configure SSH
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
SSH_HOST: ${{secrets.SSH_HOST}}
SSH_USER: ${{secrets.SSH_USER}}
run:
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/github
chmod 600 ~/.ssh/github
cat >>~/.ssh/config <<END
Host target
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/github
LogLevel ERROR
StrictHostKeyChecking no
END
- name: Run deploy
run: |
ssh target "cd fjob_backend/" && docker-compose down && git pull && docker-compose build && docker-compose up -d --force-recreate"