Merge pull request #1846 from cityofaustin/patch/3.6.1 #76
This file contains hidden or 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: "Applies migrations, metadata, and deploys ECS task definition if needed" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - production | |
| paths: | |
| - "moped-database/**" | |
| - ".github/workflows/migrations-metadata-deployment.yml" | |
| - ".github/workflows/migrations-metadata-deployment-helper.sh" | |
| jobs: | |
| apply-migrations-and-metadata: | |
| name: Apply Migrations and Metadata | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/setup-python@v4 | |
| name: "Setup Python" | |
| with: | |
| python-version: "3.8" | |
| architecture: "x64" | |
| # Get the code first | |
| - name: "Checkout Code" | |
| uses: actions/checkout@v3 | |
| # Then install the AWC CLI tools & boto3 | |
| - name: "Install AWS Cli & Hasura CLI" | |
| run: | | |
| sudo apt-get install python3-setuptools | |
| # reminder; this is V1 of the AWS CLI | |
| pip3 install awscli virtualenv | |
| curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash | |
| # Run the shell commands using the AWS environment variables | |
| - name: "Apply Migrations and Metadata" | |
| env: | |
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_MOPED_HASURA_CONFIGURATION_FILE_PRODUCTION: ${{ secrets.AWS_MOPED_HASURA_CONFIGURAITON_FILE_PRODUCTION }} | |
| AWS_MOPED_HASURA_CONFIGURATION_FILE_STAGING: ${{ secrets.AWS_MOPED_HASURA_CONFIGURAITON_FILE_STAGING }} | |
| run: | | |
| export BRANCH_NAME=${GITHUB_REF##*/} | |
| echo "SHA: ${GITHUB_SHA}" | |
| echo "ACTION/BRANCH_NAME: ${BRANCH_NAME}" | |
| echo "GR: ${GITHUB_REF}" | |
| echo "PWD: $(pwd)" | |
| source $(pwd)/.github/workflows/migrations-metadata-deployment-helper.sh | |
| run_migration_process | |
| update-ecs-task-deployment: | |
| name: Check for updated ECS task definition and deploy if needed | |
| runs-on: ubuntu-24.04 | |
| needs: apply-migrations-and-metadata | |
| if: always() | |
| steps: | |
| - name: "Checkout Code" | |
| uses: actions/checkout@v3 | |
| - name: "Install AWS CLI v2" | |
| run: | | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| sudo ./aws/install --update | |
| aws --version | |
| - name: "Install updated ECS task definition" | |
| env: | |
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| run: | | |
| export BRANCH_NAME=${GITHUB_REF##*/} | |
| echo "SHA: ${GITHUB_SHA}" | |
| echo "ACTION/BRANCH_NAME: ${BRANCH_NAME}" | |
| echo "GR: ${GITHUB_REF}" | |
| echo "PWD: $(pwd)" | |
| source $(pwd)/.github/workflows/migrations-metadata-deployment-helper.sh | |
| update_ecs_task_definition_process |