-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (87 loc) · 2.8 KB
/
cdk_release_code.yml
File metadata and controls
96 lines (87 loc) · 2.8 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: cdk release code
on:
workflow_call:
inputs:
BRANCH_NAME:
required: true
type: string
STACK_NAME:
required: true
type: string
AWS_ENVIRONMENT:
required: true
type: string
VERSION_NUMBER:
required: true
type: string
COMMIT_ID:
required: true
type: string
CDK_APP_NAME:
required: true
type: string
LOG_RETENTION_IN_DAYS:
required: true
type: string
LOG_LEVEL:
type: string
IS_PULL_REQUEST:
type: boolean
required: true
pinned_image:
required: true
type: string
secrets:
CLOUD_FORMATION_DEPLOY_ROLE:
required: true
permissions: {}
jobs:
release_code:
runs-on: ubuntu-22.04
environment: ${{ inputs.AWS_ENVIRONMENT }}
container:
image: ${{ inputs.pinned_image }}
options: --user 1001:1001 --group-add 128
defaults:
run:
shell: bash
name: deploy cdk app ${{ inputs.CDK_APP_NAME }}
permissions:
id-token: write
contents: read
steps:
- name: copy .tool-versions
run: |
cp /home/vscode/.tool-versions "$HOME/.tool-versions"
- name: build_artifact download
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: build_artifact
- name: extract build_artifact
run: tar -xf artifact.tar
- name: install dependencies
uses: ./.github/actions/install_dependencies
with:
npm-required: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure AWS Credentials
id: connect-aws-deploy
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
aws-region: eu-west-2
role-to-assume: ${{ secrets.CLOUD_FORMATION_DEPLOY_ROLE }}
role-session-name: psu-deployment
- name: Deploy AWS infrastructure and code
run: npm run cdk-deploy --workspace packages/cdk
shell: bash
env:
CDK_APP_NAME: "${{ inputs.CDK_APP_NAME }}"
CDK_CONFIG_stackName: "${{ inputs.STACK_NAME }}"
CDK_CONFIG_versionNumber: "${{ inputs.VERSION_NUMBER }}"
CDK_CONFIG_commitId: "${{ inputs.COMMIT_ID }}"
CDK_CONFIG_isPullRequest: "${{ inputs.IS_PULL_REQUEST }}"
CDK_CONFIG_environment: "${{ inputs.AWS_ENVIRONMENT }}"
CDK_CONFIG_logRetentionInDays: "${{ inputs.LOG_RETENTION_IN_DAYS }}"
CDK_CONFIG_logLevel: "${{ inputs.LOG_LEVEL }}"
REQUIRE_APPROVAL: "never"
# later, there will be API deployment steps c.f. https://github.com/NHSDigital/electronic-prescription-service-clinical-prescription-tracker/blob/main/.github/workflows/cdk_release_code.yml