generated from communitiesuk/funding-service-design-TEMPLATE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #662 from communitiesuk/feature/FPASF-461-new-depl…
…oyment-workflow FPASF-461: Update deployment workflows
- Loading branch information
Showing
3 changed files
with
104 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Reusable workflow for post-award AWS Copilot deployment | ||
run-name: Deploy branch ${{ github.ref_name }} to ${{ inputs.copilot_environment || 'test' }} (${{ format('SHA:{0}', github.sha) }}) | ||
on: | ||
workflow_call: | ||
inputs: | ||
copilot_environment: | ||
description: "Copilot environment to deploy to" | ||
type: string | ||
required: true | ||
image_location: | ||
description: "Location of the image to deploy" | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
copilot_deploy: | ||
strategy: | ||
matrix: | ||
include: | ||
- deployment: post-award | ||
command: svc | ||
- deployment: post-award-celery | ||
command: svc | ||
- deployment: download-report | ||
command: job | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.copilot_environment || 'test' }} | ||
steps: | ||
- name: Git clone the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Copilot | ||
uses: communitiesuk/funding-service-design-workflows/.github/actions/copilot_setup@main | ||
with: | ||
copilot_environment: ${{ inputs.copilot_environment || 'test' }} | ||
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }} | ||
|
||
- name: Inject env specific values into manifest | ||
run: | | ||
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/${{ matrix.deployment }}/manifest.yml | ||
yq -i '.image.location = "${{ inputs.image_location }}"' copilot/${{ matrix.deployment }}/manifest.yml | ||
- name: Run database migrations | ||
if: ${{ matrix.deployment == 'post-award' }} | ||
run: scripts/migration-task-script.py ${{ inputs.copilot_environment || 'test' }} ${{ inputs.image_location }} | ||
|
||
- name: Copilot deploy ${{ matrix.deployment }} | ||
run: | | ||
copilot ${{ matrix.command }} deploy --name ${{ matrix.deployment }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Deployment pipeline for post-award services | ||
run-name: Deploy branch ${{ github.ref_name }} to test and prod (${{ format('SHA:{0}', github.sha) }}) | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
paketo_build: | ||
permissions: | ||
packages: write | ||
concurrency: build-${{ github.sha }} | ||
uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main | ||
with: | ||
assets_required: true | ||
version_to_build: ${{ github.sha }} | ||
owner: ${{ github.repository_owner }} | ||
application: ${{ github.event.repository.name }} | ||
|
||
copilot_test_deploy: | ||
needs: [ paketo_build ] | ||
concurrency: | ||
group: deploy-test | ||
cancel-in-progress: false | ||
uses: ./.github/workflows/aws_copilot_deployment.yml | ||
with: | ||
copilot_environment: test | ||
image_location: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} | ||
secrets: inherit | ||
|
||
copilot_prod_deploy: | ||
if: ${{ github.ref_name == 'main' }} | ||
needs: [ paketo_build, copilot_test_deploy ] | ||
concurrency: | ||
group: deploy-prod | ||
cancel-in-progress: false | ||
uses: ./.github/workflows/aws_copilot_deployment.yml | ||
with: | ||
copilot_environment: prod | ||
image_location: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} | ||
secrets: inherit |