forked from deso-protocol/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 2.17 KB
/
dispatch_app_terraform.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
name: Deploy
on:
workflow_dispatch:
inputs:
environment_name:
description: Environment to deploy docker build to
type: choice
required: true
options:
- dev
- stage
docker_tag:
description: Docker build associated to git tag
required: true
jobs:
setup-environment:
name: Setup Environment
runs-on: ubuntu-latest
outputs:
aws_access_key_id_secrets_name: ${{ steps.setup.outputs.aws_access_key_id_secrets_name }}
aws_secret_access_key_secrets_name: ${{ steps.setup.outputs.aws_secret_access_key_secrets_name }}
steps:
- name: Setup
id: setup
run: |
if [ "${{ inputs.environment_name }}" = dev ]; then
echo "aws_access_key_id_secrets_name=AWS_ACCESS_KEY_ID" >> $GITHUB_OUTPUT
echo "aws_secret_access_key_secrets_name=AWS_SECRET_ACCESS_KEY" >> $GITHUB_OUTPUT
elif [ "${{ inputs.environment_name }}" = stage ]; then
echo "aws_access_key_id_secrets_name=AWS_ACCESS_KEY_ID_STAGE" >> $GITHUB_OUTPUT
echo "aws_secret_access_key_secrets_name=AWS_SECRET_ACCESS_KEY_STAGE" >> $GITHUB_OUTPUT
else
echo "Unknown environment_name ${{ inputs.environment_name }}" >2
exit 1
fi
trigger-terraform:
name: Terraform
needs: setup-environment
uses: ./.github/workflows/workflow_terraform.yml
with:
service_name: gem-frontend
docker_tag_to_deploy: ${{ inputs.docker_tag }}
environment_name: ${{ inputs.environment_name }}
aws_access_key_id_secrets_name: ${{ inputs.aws_access_key_id_secrets_name }}
aws_secret_access_key_secrets_name: ${{ inputs.aws_secret_access_key_secrets_name }}
secrets: inherit
update-env-tag:
name: Update deployment tag
runs-on: ubuntu-latest
needs: trigger-terraform
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git tag force
run: |
git checkout refs/tags/${{ inputs.docker_tag }}
git tag --force "${{ inputs.environment_name }}"
git push origin "${{ inputs.environment_name }}" --force