Skip to content

Commit b151cce

Browse files
committed
github action script 추가
1 parent aef8fd0 commit b151cce

File tree

2 files changed

+186
-0
lines changed

2 files changed

+186
-0
lines changed

.aws/workflow/deploy.yml

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

.aws/workflow/deploy_on_dev.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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/[email protected]
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

Comments
 (0)