1

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

  • Can you query Zappa through an API or a CLI command what the appropriate action is? In that case you can call that and set a Actions variable through logging a workflow command. Then use that variable in the if statement. – jessehouwing Feb 22 '22 at 07:38
  • @jessehouwing, I edited with my current workflow actions, I would like to know if possible to have some sort of if statement where I can run either ```deploy``` or ```update``` – KerryKazadi Feb 22 '22 at 07:59
  • Does Zappa deeply return a specific error code in that case? Can you run Zappa status to check the status of your deployment? – jessehouwing Feb 22 '22 at 08:13
  • @jessehouwing, I don't see how this is relavent, as mentioned above zappa returned ```error: application already deployed``` if I have already deployed the application at least once in which case I would like to have run ```zappa update``` – KerryKazadi Feb 22 '22 at 08:50
  • You can use the outcome to update your script to do the right thing. That's how ins relevant .. the run step is just a bash script. – jessehouwing Feb 22 '22 at 09:59

0 Answers0