-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend-AutoDeployTrigger-81d6ff97-4f37-4b2f-a824-9dfa54cd94fc.yml
More file actions
59 lines (50 loc) · 1.91 KB
/
backend-AutoDeployTrigger-81d6ff97-4f37-4b2f-a824-9dfa54cd94fc.yml
File metadata and controls
59 lines (50 loc) · 1.91 KB
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: Trigger auto deployment for backend
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches:
[ main ]
paths:
- '**'
- '.github/workflows/backend-AutoDeployTrigger-81d6ff97-4f37-4b2f-a824-9dfa54cd94fc.yml'
# Allow mannually trigger
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v3
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.BACKEND_AZURE_CREDENTIALS }}
- name: Build and push container image to registry
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
registryUrl: koftacrew.azurecr.io
registryUsername: ${{ secrets.BACKEND_REGISTRY_USERNAME }}
registryPassword: ${{ secrets.BACKEND_REGISTRY_PASSWORD }}
containerAppName: backend
resourceGroup: nlp-marking-assistant
imageToBuild: koftacrew.azurecr.io/backend:${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Migrate database
run: |
export SECRET_KEY=${{ secrets.SECRET_KEY }}
export DATABASE_ENGINE=${{ vars.DATABASE_ENGINE }}
export DATABASE_NAME=${{ secrets.DATABASE_NAME }}
export DATABASE_USER=${{ secrets.DATABASE_USER }}
export DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}
export DATABASE_HOST=${{ secrets.DATABASE_HOST }}
export DATABASE_PORT=${{ secrets.DATABASE_PORT }}
python manage.py migrate