-
Notifications
You must be signed in to change notification settings - Fork 3
101 lines (96 loc) · 3.11 KB
/
cd.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
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
97
98
99
100
101
name: CD
on:
workflow_call:
inputs:
deploy-infra:
description: 'Deploy infrastructure'
type: boolean
default: true
deploy-app:
description: 'Deploy application'
type: boolean
default: true
version:
description: 'The ECR tag to deploy'
type: string
required: true
image-name:
description: 'The name of the image to deploy'
type: string
default: ${{ vars.IMAGE_NAME }}
task-name:
description: 'The name of the service to deploy, used to build cluster/service/task names'
type: string
default: ${{ vars.IMAGE_NAME }}
stage:
description: 'The environment to deploy to'
type: string
required: true
stage-url:
description: 'The URL of the environment'
type: string
required: true
grafana-workspace-name:
description: 'The name of the Grafana workspace for the monitoring deployment'
type: string
default: ${{ vars.GRAFANA_WORKSPACE_NAME }}
tf-directory:
description: 'The directory containing the Terraform files'
type: string
default: ${{ vars.TF_DIRECTORY }}
tf-variables:
description: 'The values of the dynamic Terraform variables'
type: string
default: ''
aws-region:
description: 'The AWS region to deploy to'
type: string
default: ${{ vars.AWS_REGION }}
aws-role-arn:
description: 'The ARN of the AWS role to assume for the main deployment'
type: string
required: true
aws-role-monitoring-arn:
description: 'The ARN of the AWS role to assume for the monitoring deployment'
type: string
default: ${{ vars.AWS_ROLE_MONITORING }}
run-label:
description: 'The run label to use for the actions'
type: string
default: 'ubuntu-latest'
concurrency: cd-${{ inputs.stage }}
permissions:
contents: write
checks: write
id-token: write
jobs:
deploy-infra:
name: Deploy Infra
if: ${{ inputs.deploy-infra }}
secrets: inherit
uses: ./.github/workflows/deploy-infra.yml
with:
version: ${{ inputs.version }}
stage: ${{ inputs.stage }}
stage-url: ${{ inputs.stage-url }}
aws-role-monitoring-arn: ${{ inputs.aws-role-monitoring-arn }}
aws-region: ${{ inputs.aws-region }}
grafana-workspace-name: ${{ inputs.grafana-workspace-name }}
tf-directory: ${{ inputs.tf-directory }}
tf-variables: ${{ inputs.tf-variables }}
run-label: ${{ inputs.run-label }}
deploy-app:
name: Deploy App
needs: [ deploy-infra ]
if: ${{ (always() && !failure() && !cancelled()) && inputs.deploy-app }}
secrets: inherit
uses: ./.github/workflows/deploy-app.yml
with:
version: ${{ inputs.version }}
image-name: ${{ inputs.image-name }}
task-name: ${{ inputs.task-name }}
stage: ${{ inputs.stage }}
stage-url: ${{ inputs.stage-url }}
aws-role-arn: ${{ inputs.aws-role-arn }}
aws-region: ${{ inputs.aws-region }}
run-label: ${{ inputs.run-label }}