generated from credfeto/cs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (96 loc) · 4.05 KB
/
deploy.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
102
103
104
105
name: "!!Deploy: Using Cloudformation"
on:
workflow_dispatch:
# note MAX inputs = 10
inputs:
CLOUD_FORMATION_STACK:
description: '1. The Cloud Formation stack to deploy as'
required: true
CLOUD_FORMATION_TEMPLATE_FILE:
description: '2. The Cloud Formation file to deploy'
required: true
DOCKER_APP_OWNER:
description: '3. docker app owner'
required: true
DOCKER_APP_NAME:
description: '4. docker app name'
required: true
API_HOST:
description: '5. Api Host'
required: false
API_PREFIX:
description: '6. API Prefix'
required: false
AWS_LOAD_BALANCER_HOSTNAME:
description: "7. AWS Load Balancer match hostname"
required: false
AWS_LOAD_BALANCER_PRIORITY:
description: "8. AWS Load Balancer match priority"
required: true
AWS_CONTAINER_REGISTRY:
description: "9. AWS container registry to retrieve package from"
required: true
BUILD_VERSION:
description: "10. Build Version"
required: true
# Don't cancel anything in progress
concurrency:
group: ${{github.workflow}}-${{inputs.CLOUD_FORMATION_STACK}}-${{inputs.BUILD_VERSION}}
cancel-in-progress: false
permissions:
contents: write
security-events: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: "Correct ownership"
run: sudo chown -R "$USER:$USER" "$GITHUB_WORKSPACE"
- name: "Checkout"
uses: actions/[email protected]
with:
fetch-depth: 0
fetch-tags: true
- name: "Log parameters"
shell: bash
run: |
echo "CLOUD_FORMATION_STACK: ${{inputs.CLOUD_FORMATION_STACK}}"
echo "CLOUD_FORMATION_TEMPLATE_FILE: ${{inputs.CLOUD_FORMATION_TEMPLATE_FILE}}"
echo "DOCKER_APP_OWNER: ${{inputs.DOCKER_APP_OWNER}}"
echo "DOCKER_APP_NAME: ${{inputs.DOCKER_APP_NAME}}"
echo "BUILD_VERSION: ${{inputs.BUILD_VERSION}}"
echo "API_HOST: ${{inputs.API_HOST}}"
echo "API_PREFIX: ${{inputs.API_PREFIX}}"
echo "AWS_LOAD_BALANCER_HOSTNAME: ${{inputs.AWS_LOAD_BALANCER_HOSTNAME}}"
echo "AWS_CONTAINER_REGISTRY: ${{inputs.AWS_CONTAINER_REGISTRY}}"
echo "AWS_LOAD_BALANCER_PRIORITY: ${{inputs.AWS_LOAD_BALANCER_PRIORITY}}"
- name: "Configure AWS Credentials"
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_DOCKER_CONTAINER_REGISTRY_SECRET_ACCESS_KEY}}
aws-region: ${{vars.AWS_REGION}}
- name: "Cloudformation Deploy"
uses: ./.github/actions/cloudformation-deploy
with:
CLOUD_FORMATION_STACK: ${{inputs.CLOUD_FORMATION_STACK}}
CLOUDFORMATION_SNS_ARN: ${{vars.CLOUDFORMATION_SNS_ARN}}
CLOUD_FORMATION_TEMPLATE_FILE: "${{github.workspace}}/${{inputs.CLOUD_FORMATION_TEMPLATE_FILE}}"
DOCKER_APP_OWNER: ${{inputs.DOCKER_APP_OWNER}}
DOCKER_APP_NAME: ${{inputs.DOCKER_APP_NAME}}
BUILD_VERSION: ${{inputs.BUILD_VERSION}}
API_HOST: ${{inputs.API_HOST}}
API_PREFIX: ${{inputs.API_PREFIX}}
AWS_LOAD_BALANCER_HOSTNAME: ${{inputs.AWS_LOAD_BALANCER_HOSTNAME}}
AWS_LOAD_BALANCER_PRIORITY: ${{inputs.AWS_LOAD_BALANCER_PRIORITY}}
AWS_CONTAINER_REGISTRY: ${{inputs.AWS_CONTAINER_REGISTRY}}
- name: "Log Build Version"
uses: actions/[email protected]
with:
script: |
core.info('Application: \u001b[38;5;6m${{inputs.DOCKER_APP_OWNER}}\\${{inputs.DOCKER_APP_NAME}}');
core.info('Version: \u001b[38;5;6m${{inputs.BUILD_VERSION}}');
core.info('Stack: \u001b[38;5;6m${{inputs.CLOUD_FORMATION_STACK}}');
core.notice('Application: ${{inputs.DOCKER_APP_OWNER}}\\${{inputs.DOCKER_APP_NAME}}');
core.notice('Version: ${{inputs.BUILD_VERSION}}');
core.notice('Stack: ${{inputs.CLOUD_FORMATION_STACK}}');