-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (55 loc) · 1.75 KB
/
setup_deployment.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
name: "Set up deployment of latest code to AWS"
on:
push:
branches:
- develop
- master
- preview
- production
jobs:
determine-environment:
runs-on: ubuntu-latest
outputs:
ENV_NAME: ${{ steps.determine_environment.outputs.ENV_NAME }}
steps:
- name: Determine the environment to deploy to
id: determine_environment
run: |
echo "ENV_NAME=$(
case ${{ github.ref }} in
"refs/heads/master")
echo "CMPDEV"
;;
"refs/heads/develop")
echo "Sandbox"
;;
"refs/heads/preview")
echo "Preview"
;;
"refs/heads/production")
echo "Production"
;;
*)
echo "FAIL"
;;
esac
)" >> $GITHUB_OUTPUT
- name: Fail if not an environment
run: |
echo "ERROR: No environment found"
exit 1
if: steps.determine_environment.outputs.ENV_NAME == 'FAIL'
- name: Show where we are deploying to
run: echo "We will deploy to ${{ steps.determine_environment.outputs.ENV_NAME }}"
deploy-to-aws:
uses: ./.github/workflows/deploy_to_aws.yml
needs:
- determine-environment
with:
environment: ${{ needs.determine-environment.outputs.ENV_NAME }}
secrets:
AWS_PIPELINE_REGION: ${{ secrets.AWS_PIPELINE_REGION }}
AWS_PIPELINE_ACCESS_KEY: ${{ secrets.AWS_PIPELINE_ACCESS_KEY }}
AWS_PIPELINE_SECRET_KEY: ${{ secrets.AWS_PIPELINE_SECRET_KEY }}
AWS_PIPELINE_MAIN_NAME: ${{ secrets.AWS_PIPELINE_MAIN_NAME }}
AWS_PIPELINE_SIDEKIQ_NAME: ${{ secrets.AWS_PIPELINE_SIDEKIQ_NAME }}