Merge pull request #44 from DevOps-Cloud-Team5/SCRUM-92_cf #58
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.10.8 | |
- name: Set up virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Prepare Zappa and Terraform Configurations | |
run: | | |
sed -i "s/PLACEHOLDER_REGION/${{ secrets.AWS_REGION }}/g" zappa_settings.json | |
sed -i "s/zappa-PLACEHOLDER_PROJECT_NAME/zappa-${{ secrets.PROJECT_NAME }}/g" zappa_settings.json | |
sed -i "s/PLACEHOLDER_REGION/${{ secrets.AWS_REGION }}/g" ./deployments/main.tf | |
sed -i "s/PLACEHOLDER_PROJECT_NAME/${{ secrets.PROJECT_NAME }}/g" ./deployments/main.tf | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Setup up Requirements | |
run: | | |
source venv/bin/activate | |
chmod +x ./getEnv.sh && ./getEnv.sh | |
python load_env.py | |
zappa package prod -o package.zip | |
- name: Deploy | |
run: | | |
cd deployments | |
terraform init | |
terraform apply -auto-approve |