1+ name : Deploy Django with zappa on DEV stage
2+
3+ on :
4+ push :
5+ branches : [devdev]
6+
7+ jobs :
8+ build :
9+
10+ runs-on : ubuntu-latest
11+ strategy :
12+ matrix :
13+ python-version : [3.8]
14+
15+ steps :
16+ - uses : actions/checkout@v2
17+ - uses : psf/black@stable
18+ with :
19+ options : " --check --verbose"
20+ src : " ./pyconweb2022"
21+
22+ - name : Set up Python ${{ matrix.python-version }}
23+ uses : actions/setup-python@v2
24+ with :
25+ python-version : ${{ matrix.python-version }}
26+
27+ - name : Install mysql common
28+ run : |
29+ sudo apt-get install -y mysql-common
30+
31+ # - name: Install python version
32+ # uses: gabrielfalcao/pyenv-action@v9
33+ # with:
34+ # default: "${{ matrix.python }}"
35+ # command: |
36+ # python -m pip install --upgrade pip
37+ # pip install pytest
38+ # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
39+
40+ - name : Setup Virtualenv
41+ run : |
42+ pip install virtualenv
43+
44+ - name : Create Virtualenv
45+ run : |
46+ virtualenv pyconweb2022-zappa
47+
48+ # - name: Activate Virtualenv
49+ # run: |
50+ # source ./pyconweb2022-zappa/bin/activate
51+
52+ - name : Install dependencies
53+ run : |
54+ source ./pyconweb2022-zappa/bin/activate
55+ python -m pip install --upgrade pip
56+ pip install pytest
57+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
58+
59+ # Pull request dose not get the gitub action secrets
60+ # this section will be applied to the deploy workflow
61+ - name : Setup Auth for Private Repo
62+ uses : webfactory/ssh-agent@v0.5.4
63+ with :
64+ ssh-private-key : ${{ secrets.SSH_SECRET_GOLONY }}
65+ # ssh-private-key: ${{ secrets.GH_PYCONKR_SECRETS }}
66+
67+ - name : update pyconkr-secretes
68+ run : |
69+ ./update_secrets.sh
70+
71+ - name : Test with Django Test
72+ run : |
73+ source ./pyconweb2022-zappa/bin/activate
74+ cd pyconweb2022
75+ python manage.py test
76+
77+ - name : Test with pytest
78+ run : |
79+ source ./pyconweb2022-zappa/bin/activate
80+ pytest pyconweb2022
81+
82+ - name : Configure AWS Credentials
83+ uses : aws-actions/configure-aws-credentials@v1
84+ with :
85+ aws-access-key-id : ${{ secrets.PYCON_DEV_2021_AWS_KEY }}
86+ aws-secret-access-key : ${{ secrets.PYCON_DEV_2021_AWS_SECRET }}
87+ aws-region : ap-northeast-2
88+
89+ - name : Zappa Deploy(Update)
90+ env :
91+ AWS_ACCESS_KEY_ID : ${{ secrets.PYCON_DEV_2021_AWS_KEY }}
92+ AWS_SECRET_ACCESS_KEY : ${{ secrets.PYCON_DEV_2021_AWS_SECRET }}
93+ run : |
94+ source ./pyconweb2022-zappa/bin/activate
95+ cd pyconweb2022
96+ zappa update dev
97+ # zappa manage dev collectstatic
0 commit comments