-
Notifications
You must be signed in to change notification settings - Fork 23
58 lines (55 loc) · 2.25 KB
/
build_and_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
on:
workflow_call:
inputs:
environment:
required: false
type: string
default: "staging"
core_app:
required: false
type: string
description: "Core app name"
default: "assets"
jobs:
set-env-variable:
runs-on: ubuntu-latest
outputs:
ACCOUNT_NUMBER: ${{ steps.set-env-var.outputs.ACCOUNT_NUMBER }}
APP_NAME: ${{ steps.set-env-var.outputs.APP_NAME }}
PURGE_HOST: ${{ steps.set-env-var.outputs.PURGE_HOST }}
steps:
- name: Set Environment Variable
id: set-env-var
run: |
if [ "${{ inputs.environment }}" == "staging" ]; then
echo "ACCOUNT_NUMBER=070528468658" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}-staging" >> $GITHUB_OUTPUT
echo "PURGE_HOST=assets-staging.polygon.technology" >> $GITHUB_OUTPUT
elif [ "${{ inputs.environment }}" == "prod" ]; then
echo "ACCOUNT_NUMBER=042947190491" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}" >> $GITHUB_OUTPUT
echo "PURGE_HOST=assets.polygon.technology" >> $GITHUB_OUTPUT
fi
deploy:
uses: 0xPolygon/pipelines/.github/workflows/ecs_deploy_docker_taskdef.yaml@main
needs: set-env-variable
with:
app_name: ${{ needs.set-env-variable.outputs.APP_NAME }}
taskdef_file_vars: .github/taskdef/${{ inputs.environment }}-taskdef.yaml
aws_region: eu-west-1
environment: ${{ inputs.environment }}
cluster_name: frontend-${{ inputs.environment }}-ecs-cluster
account_number: "${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }}"
secrets: inherit
cloudflare-purge:
runs-on: ubuntu-latest
needs:
- set-env-variable # Ensures it waits for set-env-variable to complete
- deploy # Ensures it waits for deploy to complete
steps:
- name: Cloudflare Cache Purge
uses: nathanvaughn/actions-cloudflare-purge@master
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}
hosts: ${{ needs.set-env-variable.outputs.PURGE_HOST }}