Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Deploy to AWS

Deploy to AWS #34

name: Deploy to AWS
on:
workflow_dispatch:
inputs:
environment:
description: Which AWS Account to use
type: choice
required: true
options:
- dev
- test
- uat
- production
run_performance_tests:
required: false
default: false
type: boolean
description: Run performance tests
run_e2e_tests:
required: false
default: true
type: boolean
description: Run e2e tests
push:
# Ignore README markdown
# Only automatically deploy when something in the app or tests folder has changed
paths:
- '!**/README.md'
- 'app/**'
- 'tests/**'
- 'requirements-dev.in'
- 'requirements-dev.txt'
- 'requirements.in'
- 'requirements.txt'
jobs:
paketo_build:
permissions:
packages: write
uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main
with:
version_to_build: $(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
owner: ${{ github.repository_owner }}
application: funding-service-design-fund-store
pre_deploy_tests:
secrets:
E2E_PAT: ${{secrets.E2E_PAT}}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/pre-deploy.yml@main
with:
# Note - no db-name, so defaults to postgres_db
postgres_unit_testing: true
dev_copilot_deploy:
if: inputs.environment == 'dev' || inputs.environment == ''
needs: [pre_deploy_tests, paketo_build]
concurrency: deploy-dev
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
uses: ./.github/workflows/environment.yml
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
with:
workspace: 'dev'
test_copilot_deploy:
if: inputs.environment == 'test' || inputs.environment == ''
needs: [pre_deploy_tests, paketo_build]
concurrency: deploy-test
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
uses: ./.github/workflows/environment.yml
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
with:
workspace: 'test'
# Allow the capability to override UAT with another branch, but ideally uat and production should be in sync as much as possible
uat_copilot_deploy:
if: inputs.environment == 'uat' || inputs.environment == ''
needs: [pre_deploy_tests, paketo_build]
concurrency: deploy-uat
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
uses: ./.github/workflows/environment.yml
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
with:
workspace: 'uat'
# Only run this if the branch being deployed is main
production_copilot_deploy:
if: (inputs.environment == 'production' || inputs.environment == '') && github.ref == 'refs/heads/main'
needs: [pre_deploy_tests, paketo_build]
concurrency: deploy-production
secrets:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
uses: ./.github/workflows/environment.yml
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
with:
workspace: 'production'
# Can we realistically run E2E at this stage, or just plump for application on the grounds it checks fund-store is operational?
post_deploy_tests:
needs: test_copilot_deploy
secrets:
E2E_PAT: ${{secrets.E2E_PAT}}
uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main
with:
run_performance_tests: ${{ inputs.run_performance_tests }}
run_e2e_tests: ${{ inputs.run_e2e_tests }}
app_name: application