If statement in Github actions if Zappa already deploy application

328 Views Asked by At

How do I specify whether to zappa deploy or zappa update my application in Github actions with some sort of if statement

My Workflow Actions as per below

name: Dev Deploy
on:
  push:
    branches:
      - mybranch

jobs:
  dev-deploy:
    name: Deploy to Dev
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Set up Python 3.9.10
        uses: actions/setup-python@v1
        with:
          python-version: 3.9.10

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install pytest
          pip install python-Levenshtein
          pip install virtualenv

      - name: Install zappa
        run: pip install zappa

      - name: Install Serverless
        run: npm install -g serverless

      - name: Configure Serverless for zappa Services
        run:  serverless config credentials --provider aws --key myAWSKey --secret myAWSSecret

      - name: Deploy to Dev
        run: |
            python -m virtualenv envsp
            source envsp/bin/activate
            zappa deploy dev

If application already deployed once, I get the error

Error: This application is already deployed - did you mean to call update?

In which case I would want to run zappa update dev

0

There are 0 best solutions below