Skip to content

Merge pull request #449 from data-mermaid/use-fifo-env-var #265

Merge pull request #449 from data-mermaid/use-fifo-env-var

Merge pull request #449 from data-mermaid/use-fifo-env-var #265

Workflow file for this run

name: DeployCDKStacks
on:
push:
branches:
- dev
tags:
- 'v[0-9]+.[0-9]+' # eg: v1.1
- 'v[0-9]+.[0-9]+.[0-9]+' # eg: v1.1.1
# The following tags allow you to deploy prod on the new AWS account only.
# TODO: remove after migration
- 'w[0-9]+.[0-9]+' # eg: w1.1
- 'w[0-9]+.[0-9]+.[0-9]+' # eg: w1.1.1
concurrency:
group: api-deployment-${{ github.ref }}
jobs:
call-test:
uses: ./.github/workflows/_test.yml
deploy:
needs: [call-test]
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/checkout@v3
- name: Install CDK
run: |
iac/install_cdk.sh
- name: Set target and version for dev
if: startsWith(github.ref, 'refs/heads/dev')
run: |
echo "TARGET=dev" >> "$GITHUB_ENV"
short_sha=$(git rev-parse --short ${{ github.sha }})
echo "$short_sha" > src/VERSION.txt
cat src/VERSION.txt
- name: Set target and version for prod
if: startsWith(github.ref, 'refs/tags')
run: |
echo "TARGET=prod" >> "$GITHUB_ENV"
echo "${{ github.ref_name }}" > src/VERSION.txt
cat src/VERSION.txt
- name: CDK Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_CDK }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_CDK }}
SYS_EMAIL: ${{ secrets.SYS_EMAIL }}
PYTHONPATH: ${{ github.workspace }}
DEPLOY_AWS_ACCT: ${{ secrets.DEPLOY_AWS_ACCT }}
run: |
cd iac && cdk deploy \
--require-approval never \
"${{ env.TARGET }}"-mermaid-api-django \
"${{ env.TARGET }}"-mermaid-static-site