-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (88 loc) · 2.79 KB
/
dispatch_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
name: ⚙️ Deploy
run-name: "Deploy: ${{ github.sha }} ➠ ${{ inputs.version-type }}:${{ inputs.version-tag }}${{ (!inputs.deploy-infra && !inputs.deploy-app) && ' 👀 deploy nothing' || ''}}${{ inputs.deploy-infra && ' ❱❱ infra' || '' }}${{ inputs.deploy-app && ' ❱❱ app' || '' }}"
on:
workflow_dispatch:
inputs:
deploy-infra:
description: "Deploy Infra"
default: true
required: true
type: boolean
deploy-app:
description: "Deploy App"
default: true
required: true
type: boolean
stage:
description: 'Target Environment'
type: choice
options:
- staging
- prod
default: staging
required: true
version-type:
description: "Release Version"
type: choice
options:
- latest
- current
- manual
default: 'latest'
required: true
version-tag:
description: "Release Version Tag (for manual version)"
type: string
default: ''
concurrency: deploy
permissions:
contents: write
checks: write
id-token: write
packages: write
jobs:
get_deployed_version:
name: Lookup Version
if: ${{ inputs.version-type == 'current' }}
secrets: inherit
uses: WalletConnect/ci_workflows/.github/workflows/[email protected]
with:
task-name: ${{ vars.IMAGE_NAME }}
aws-region: ${{ vars.AWS_REGION }}
aws-role-arn: ${{vars.AWS_ROLE_PROD}}
run-group: ${{ vars.RUN_GROUP }}
select_version:
name: Select Version
needs: [ get_deployed_version ]
if: ${{ always() && !cancelled() && !failure() }}
runs-on:
group: ${{ vars.RUN_GROUP }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 15
fetch-tags: true
- name: Select target version
id: select_version
run: |
if [ "${{ inputs.version-type }}" == "current" ]; then
echo "version=${{ needs.get_deployed_version.outputs.version }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.version-type }}" == "latest" ]; then
echo "version=$(git tag | sort --version-sort | tail -n1)" >> "$GITHUB_OUTPUT"
else
echo "version=${{ inputs.version-tag }}" >> "$GITHUB_OUTPUT"
fi
outputs:
version: ${{ steps.select_version.outputs.version }}
cd:
name: CD
uses: ./.github/workflows/sub-cd.yml
needs: [ select_version ]
if: ${{ always() && !cancelled() && !failure() }}
secrets: inherit
with:
deploy-infra: ${{ inputs.deploy-infra }}
deploy-app: ${{ inputs.deploy-app }}
deploy-prod: ${{ inputs.stage == 'prod' }}
version: ${{ needs.select_version .outputs.version }}