-
Notifications
You must be signed in to change notification settings - Fork 7
69 lines (60 loc) · 1.93 KB
/
server-env.yml
File metadata and controls
69 lines (60 loc) · 1.93 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
60
61
62
63
64
65
66
67
68
69
on:
workflow_call:
inputs:
ENV_NAME:
required: true
type: string
secrets:
PROJECT_NAME:
required: true
AZURE_CREDENTIALS:
required: true
DBSA_PASSWORD:
required: true
jobs:
deploy-environment-webapp:
runs-on: ubuntu-latest
steps:
- name: Use Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/checkout@v1
with:
fetch-depth: 9
submodules: false
- uses: actions/cache@v1
id: depcache
with:
path: deps
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
- name: Download dependencies
if: steps.depcache.outputs.cache-hit != 'true'
working-directory: server
run: |
pip download --dest=deps -r requirements.txt
- name: Install dependencies
working-directory: server
run: |
pip install -U --no-index --find-links=deps deps/*
- name: Run DB migrations
working-directory: server
run: |
ENV=dev
DB_NAME="$ENV-${PROJECT_NAME}pg"
DB_MIGCONNSTRING="postgresql+psycopg2://pgsqladmin@$DB_NAME:$DBSA_PASSWORD@$DB_NAME.postgres.database.azure.com:5432/$PROJECT_NAME" alembic upgrade head
env:
PROJECT_NAME: ${{ secrets.PROJECT_NAME }}
DBSA_PASSWORD: ${{ secrets.DBSA_PASSWORD }}
- name: Download a distribution artifact
uses: actions/download-artifact@v2
with:
name: app-package
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/webapps-deploy@v2
with:
app-name: ${{ inputs.ENV_NAME }}-${{ secrets.PROJECT_NAME }}
package: release.zip
startup-command: "gunicorn --bind=0.0.0.0 --workers=4 -k uvicorn.workers.UvicornWorker server:app"