-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 1.96 KB
/
main.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
name: Continuous Integration
on:
push:
branches:
- main
concurrency:
group: main
cancel-in-progress: true
jobs:
quality-assurance:
name: Quality Assurance
uses: ./.github/workflows/code-verification.yml
secrets:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }}
CORS_ALLOWED_ORIGINS: ${{ secrets.CORS_ALLOWED_ORIGINS }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_HOST_TEST: ${{ secrets.DB_HOST_TEST }}
CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }}
DEBUG: ${{ secrets.DEBUG }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SES_REGION_NAME: ${{ secrets.AWS_SES_REGION_NAME }}
AWS_SES_REGION_ENDPOINT: ${{ secrets.AWS_SES_REGION_ENDPOINT }}
FRONTEND_BASE_URL: ${{ secrets.FRONTEND_BASE_URL }}
deploy:
name: Deploy
needs: quality-assurance
runs-on: ubuntu-20.04
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: Pull latest changes
run: ssh target "cd MovieMate-backend/ && git pull"
- name: Build and redeploy
run: ssh target "cd MovieMate-backend/ && docker-compose -f docker-compose.prod.yml down && docker-compose -f docker-compose.prod.yml build && docker-compose -f docker-compose.prod.yml up -d --force-recreate"