Skip to content

Merge pull request #153 from pythonkr/feature/add-support-for-year #171

Merge pull request #153 from pythonkr/feature/add-support-for-year

Merge pull request #153 from pythonkr/feature/add-support-for-year #171

Workflow file for this run

name: Deploy Django with zappa on DEV stage
on:
push:
branches: [devdev]
workflow_dispatch:
jobs:
build:
if: github.repository_owner == 'pythonkr'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
#- uses: psf/black@stable
# with:
# options: "--check --verbose"
- 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 zappa-env
# - name: Activate Virtualenv
# run: |
# source ./zappa-env/bin/activate
- name: Install dependencies
run: |
source ./zappa-env/bin/activate
python -m pip install --upgrade pip
pip install pytest
pip install zappa
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Pull request dose not get the gitub action secrets
# this section will be applied to the deploy workflows
- name: Setup Auth for Private Repo
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_SECRET_GOLONY }}
# ssh-private-key: ${{ secrets.GH_PYCONKR_SECRETS }}
- name: update pyconkr-secretes
run: |
chmod 775 ./update_secrets.sh
./update_secrets.sh
# - name: Test with Django Test
# run: |
# source ./zappa-env/bin/activate
# python manage.py test
#
# - name: Test with pytest
# run: |
# source ./zappa-env/bin/activate
# pytest .
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PYCON_DEV_2023_AWS_KEY }}
aws-secret-access-key: ${{ secrets.PYCON_DEV_2023_AWS_SECRET }}
aws-region: ap-northeast-2
- name: Zappa Deploy(Update)
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PYCON_DEV_2023_AWS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PYCON_DEV_2023_AWS_SECRET }}
run: |
source ./zappa-env/bin/activate
zappa update dev2023
# zappa manage dev2023 "collectstatic --no-input"
- name: Collect Static Files to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PYCON_DEV_2023_AWS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PYCON_DEV_2023_AWS_SECRET }}
AWS_S3_ACCESS_KEY_ID: ${{ secrets.PYCON_DEV_2023_AWS_KEY }}
AWS_S3_SECRET_ACCESS_KEY: ${{ secrets.PYCON_DEV_2023_AWS_SECRET }}
run: |
source ./zappa-env/bin/activate
python manage.py collectstatic --no-input --settings=pyconkr.settings-dev