Skip to content

try to fix region issue #2

try to fix region issue

try to fix region issue #2

Workflow file for this run

name: Push to Docker image to AWS ECR and deploy to AWS EC2
on:
workflow_dispatch:
inputs:
development-environment:
description: Development environment to deploy to.
required: true
default: staging
type: choice
options:
- staging
- production
pull_request:
branches:
- main
types:
- closed
paths-ignore:
- 'web/deploy/terraform/**'
workflow_call:
inputs:
development-environment:
description: Development environment to deploy to. Usually `staging` or `production`
required: true
default: staging
type: string
permissions:
id-token: write
contents: read
jobs:
set-development-environment:
runs-on: ubuntu-latest
name: Set development environment
outputs:
development-environment: ${{ steps.set-development-environment.outputs.development-environment }}
steps:
- name: Set development environment
id: set-development-environment
run: |
if [[ "${{ github.event_name }}" == 'pull_request' || "${{ inputs.development-environment }}" == 'staging' ]]; then
echo "development-environment=staging" >> $GITHUB_OUTPUT
else
echo "development-environment=production" >> $GITHUB_OUTPUT
fi
cat "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT" | grep 'development-environment'
infrastructure-modified:
runs-on: ubuntu-latest
name: Check for modified infrastructure
outputs:
modified-files: ${{ steps.set-output.outputs.modified-files }}
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Get modified infrastructure configuration
id: infrastructure-modified
uses: tj-actions/changed-files@v45
with:
files: |
web/deploy/terraform/**
- name: Set modified output
id: set-output
env:
MODIFIED_FILES: ${{ steps.infrastructure-modified.outputs.any_modified }}
run: |
echo "modified-files=${MODIFIED_FILES}" >> $GITHUB_OUTPUT
build-and-push:
needs: [infrastructure-modified, set-development-environment]
strategy:
matrix:
deployment: ["api", "dashboard"]
uses: ./.github/workflows/build-docker.yml
if: ( (github.event_name == 'pull_request' && github.event.pull_request.merged == true && needs.infrastructure-modified.outputs.modified-files != 'true' && needs.set-development-environment.result == 'success') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'workflow_call') )
secrets: inherit
with:
deployment: ${{ matrix.deployment }}
docker-up:
needs: [build-and-push, set-development-environment, infrastructure-modified]
if: ${{ always() && !cancelled() && needs.build-and-push.result == 'success' && ( (github.event_name == 'pull_request' && github.event.pull_request.merged == 'true' && needs.infrastructure-modified.outputs.modified-files != 'true') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'push') || (github.event_name == 'workflow_call') )}}
name: Deploy and run Docker images on EC2
uses: ./.github/workflows/docker-up.yml
secrets: inherit
with:
development-environment: ${{ needs.set-development-environment.outputs.development-environment }}