잘못된 환경변수 설정 수정 #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Django with zappa on DEV stage | |
on: | |
push: | |
branches: [devdev] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: psf/black@stable | |
with: | |
options: "--check --verbose" | |
src: "./pyconweb2022" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install mysql common | |
run: | | |
sudo apt-get install -y mysql-common | |
# - name: Install python version | |
# uses: gabrielfalcao/pyenv-action@v9 | |
# with: | |
# default: "${{ matrix.python }}" | |
# command: | | |
# python -m pip install --upgrade pip | |
# pip install pytest | |
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Setup Virtualenv | |
run: | | |
pip install virtualenv | |
- name: Create Virtualenv | |
run: | | |
virtualenv pyconweb2022-zappa | |
# - name: Activate Virtualenv | |
# run: | | |
# source ./pyconweb2022-zappa/bin/activate | |
- name: Install dependencies | |
run: | | |
source ./pyconweb2022-zappa/bin/activate | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Get current date and repo name | |
id: info | |
run: | | |
echo "::set-output name=date::$(date +'%Y-%m-%d_%H:%M:%S')" | |
echo "::set-output name=repository_name::$(echo ${{ github.repository }} | sed -e 's/${{ github.repository_owner }}\///')" | |
# Checkout and import zappa config & environment variables from secrets repo | |
- name: Checkout secrets repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.PYCONKR_SECRET_REPOSITORY }} | |
ssh-key: ${{ secrets.PYCONKR_SECRET_REPOSITORY_DEPLOY_KEY }} | |
path: secret_envs | |
clean: false | |
sparse-checkout-cone-mode: false | |
sparse-checkout: ${{ steps.info.outputs.repository_name }}/pyconweb2022/zappa_settings.json | |
- run: mv secret_envs/${{ steps.info.outputs.repository_name }}/pyconweb2022/zappa_settings.json ./pyconweb2022 && rm -rf secret_envs | |
- name: Test with Django Test | |
run: | | |
source ./pyconweb2022-zappa/bin/activate | |
cd pyconweb2022 | |
python manage.py test | |
- name: Test with pytest | |
run: | | |
source ./pyconweb2022-zappa/bin/activate | |
pytest pyconweb2022 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.PYCON_DEV_2021_AWS_KEY }} | |
aws-secret-access-key: ${{ secrets.PYCON_DEV_2021_AWS_SECRET }} | |
aws-region: ap-northeast-2 | |
- name: Zappa Deploy(Update) | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.PYCON_DEV_2021_AWS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.PYCON_DEV_2021_AWS_SECRET }} | |
run: | | |
source ./pyconweb2022-zappa/bin/activate | |
cd pyconweb2022 | |
zappa update dev | |
# zappa manage dev collectstatic |