-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (66 loc) · 1.97 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
60
61
62
63
64
65
66
67
68
name: Test and deploy
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_SECRET_KEY: reallysupersecret
DJANGO_SETTINGS_MODULE: mbm.settings
DB_HOST: localhost
DB_USERNAME: postgres
DB_PASSWORD: postgres
services:
postgres:
image: postgres:11
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends gdal-bin
pip install --upgrade pip
pip install --upgrade -r app/requirements.txt
- name: Run tests
run: |
cp -R tests app/tests
cd app && pytest
deploy:
needs: test
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
environment: Dev
env:
AWS_REGION: us-east-2
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.IAMROLE_GITHUB }}
role-session-name: GitHub-Action-Role
aws-region: ${{ env.AWS_REGION }}
- run: |
echo "Deploying branch ${{ env.GITHUB_REF }} to ${{ github.event.inputs.environment }}"
commit_hash=`git rev-parse HEAD`
aws deploy create-deployment --application-name mellow-bike-map --deployment-group-name production --github-location repository=$GITHUB_REPOSITORY,commitId=$commit_hash --ignore-application-stop-failures