From e6488b6061dead707bb5c69f136a8b7be56cf3fb Mon Sep 17 00:00:00 2001 From: Kenneth Lippold Date: Tue, 24 Sep 2024 12:34:11 -0700 Subject: [PATCH] Update aws_deploy_hydroserver.yml --- .github/workflows/aws_deploy_hydroserver.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/aws_deploy_hydroserver.yml b/.github/workflows/aws_deploy_hydroserver.yml index d88a42f..c95472c 100644 --- a/.github/workflows/aws_deploy_hydroserver.yml +++ b/.github/workflows/aws_deploy_hydroserver.yml @@ -149,6 +149,24 @@ jobs: ] EOF + - name: Check if ElasticBeanstalk Application Version Exists + id: eb_version_exists + working-directory: ./backend + run: | + aws elasticbeanstalk describe-application-versions \ + --application-name hydroserver-${{ github.event.inputs.environment }} \ + --version-label "${{ github.event.inputs.hydroserver-version || steps.get_latest_tag.outputs.tag }}" \ + || echo "Application version does not exist." + + - name: Delete Existing ElasticBeanstalk Application Version + if: success() && steps.eb_version_exists.outputs != '' # Only run if the version exists + working-directory: ./backend + run: | + aws elasticbeanstalk delete-application-version \ + --application-name hydroserver-${{ github.event.inputs.environment }} \ + --version-label "${{ github.event.inputs.hydroserver-version || steps.get_latest_tag.outputs.tag }}" \ + --delete-source-bundle + - name: Create ElasticBeanstalk Application Version working-directory: ./backend run: |