-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (39 loc) · 1.63 KB
/
environment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Environment Deployment
on:
workflow_call:
inputs:
workspace:
required: true
type: string
jobs:
copilot_deploy:
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.workspace }}
steps:
- name: Git clone the repository
uses: actions/checkout@v4
- name: Get current date
id: currentdatetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy
role-session-name: FRONTEND_${{ inputs.workspace }}_COPILOT_${{ steps.currentdatetime.outputs.datetime }}
aws-region: eu-west-2
- name: Install AWS Copilot CLI
run: |
curl -Lo aws-copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x aws-copilot && sudo mv aws-copilot /usr/local/bin/copilot
- name: Inject Git SHA into manifest
run: |
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/fsd-frontend/manifest.yml
- name: Inject replacement image into manifest
run: |
yq -i '.image.location = "ghcr.io/communitiesuk/funding-service-design-frontend:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}"' copilot/fsd-frontend/manifest.yml
- name: Copilot ${{ inputs.workspace }} deploy
id: deploy_build
run: |
copilot svc deploy --env ${{ inputs.workspace }}