|
| 1 | +name: Deploy to AWS |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + environment: |
| 6 | + description: Which AWS Account to use |
| 7 | + type: choice |
| 8 | + required: true |
| 9 | + options: |
| 10 | + - dev |
| 11 | + - test |
| 12 | + - uat |
| 13 | + - production |
| 14 | + run_performance_tests: |
| 15 | + required: false |
| 16 | + default: false |
| 17 | + type: boolean |
| 18 | + description: Run performance tests |
| 19 | + run_e2e_tests: |
| 20 | + required: false |
| 21 | + default: true |
| 22 | + type: boolean |
| 23 | + description: Run e2e tests |
| 24 | + push: |
| 25 | + # Ignore README markdown |
| 26 | + # Only automatically deploy when something in the app or tests folder has changed |
| 27 | + paths: |
| 28 | + - '!**/README.md' |
| 29 | + - 'app/**' |
| 30 | + - 'tests/**' |
| 31 | + |
| 32 | +jobs: |
| 33 | + paketo_build: |
| 34 | + permissions: |
| 35 | + packages: write |
| 36 | + uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main |
| 37 | + with: |
| 38 | + version_to_build: $(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') |
| 39 | + owner: ${{ github.repository_owner }} |
| 40 | + application: funding-service-design-account-store |
| 41 | + pre_deploy_tests: |
| 42 | + secrets: |
| 43 | + E2E_PAT: ${{secrets.E2E_PAT}} |
| 44 | + uses: communitiesuk/funding-service-design-workflows/.github/workflows/pre-deploy.yml@main |
| 45 | + with: |
| 46 | + # Note - no db-name, so defaults to postgres_db |
| 47 | + postgres_unit_testing: true |
| 48 | + |
| 49 | + dev_copilot_deploy: |
| 50 | + if: inputs.environment == 'dev' || inputs.environment == '' |
| 51 | + needs: [pre_deploy_tests, paketo_build] |
| 52 | + concurrency: deploy-dev |
| 53 | + secrets: |
| 54 | + AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} |
| 55 | + uses: ./.github/workflows/environment.yml |
| 56 | + permissions: |
| 57 | + id-token: write # This is required for requesting the JWT |
| 58 | + contents: read # This is required for actions/checkout |
| 59 | + with: |
| 60 | + workspace: 'dev' |
| 61 | + |
| 62 | + test_copilot_deploy: |
| 63 | + if: inputs.environment == 'test' || inputs.environment == '' |
| 64 | + needs: [pre_deploy_tests, paketo_build] |
| 65 | + concurrency: deploy-test |
| 66 | + secrets: |
| 67 | + AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} |
| 68 | + uses: ./.github/workflows/environment.yml |
| 69 | + permissions: |
| 70 | + id-token: write # This is required for requesting the JWT |
| 71 | + contents: read # This is required for actions/checkout |
| 72 | + with: |
| 73 | + workspace: 'test' |
| 74 | + |
| 75 | + # Allow the capability to override UAT with another branch, but ideally uat and production should be in sync as much as possible |
| 76 | + uat_copilot_deploy: |
| 77 | + if: inputs.environment == 'uat' || inputs.environment == '' |
| 78 | + needs: [pre_deploy_tests, paketo_build] |
| 79 | + concurrency: deploy-uat |
| 80 | + secrets: |
| 81 | + AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} |
| 82 | + uses: ./.github/workflows/environment.yml |
| 83 | + permissions: |
| 84 | + id-token: write # This is required for requesting the JWT |
| 85 | + contents: read # This is required for actions/checkout |
| 86 | + with: |
| 87 | + workspace: 'uat' |
| 88 | + |
| 89 | + # Only run this if the branch being deployed is main |
| 90 | + production_copilot_deploy: |
| 91 | + if: (inputs.environment == 'production' || inputs.environment == '') && github.ref == 'refs/heads/main' |
| 92 | + needs: [pre_deploy_tests, paketo_build] |
| 93 | + concurrency: deploy-production |
| 94 | + secrets: |
| 95 | + AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} |
| 96 | + uses: ./.github/workflows/environment.yml |
| 97 | + permissions: |
| 98 | + id-token: write # This is required for requesting the JWT |
| 99 | + contents: read # This is required for actions/checkout |
| 100 | + with: |
| 101 | + workspace: 'production' |
| 102 | + |
| 103 | + # Can we realistically run E2E at this stage, or just plump for application on the grounds it checks account-store is operational? |
| 104 | + post_deploy_tests: |
| 105 | + needs: test_copilot_deploy |
| 106 | + secrets: |
| 107 | + E2E_PAT: ${{secrets.E2E_PAT}} |
| 108 | + uses: communitiesuk/funding-service-design-workflows/.github/workflows/post-deploy.yml@main |
| 109 | + with: |
| 110 | + run_performance_tests: ${{ inputs.run_performance_tests }} |
| 111 | + run_e2e_tests: ${{ inputs.run_e2e_tests }} |
| 112 | + app_name: application |
0 commit comments