-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (93 loc) · 3.63 KB
/
release-get_deployed_version.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
name: Release - Get Deployed Version
on:
workflow_call:
inputs:
task-definition-name:
description: 'The complete name of the ECS task'
type: string
default: ''
container-name:
description: 'The complete name of the ECS task container'
type: string
default: ''
aws-region:
description: 'The AWS region where the task is defined'
type: string
default: ${{ vars.AWS_REGION }}
aws-role-arn:
description: 'The ARN of the AWS role to assume to retrieve the ECS task information'
type: string
required: true
task-name-prefix:
description: 'The prefix of the ECS task name (used if inputs.task-definition-name is not defined)'
type: string
default: 'wc'
task-name-stage:
description: 'The environment of the ECS task (used if inputs.task-definition-name is not defined)'
type: string
default: ''
task-name:
description: 'The name of the ECS task (used if inputs.task-definition-name is not defined)'
type: string
default: ${{ vars.IMAGE_NAME }}
task-name-delimiter:
description: 'The delimiter used to build the task name (if inputs.task-definition-name is not defined)'
type: string
default: '-'
run-label:
description: 'The run label to use for the actions'
type: string
default: 'ubuntu-latest'
outputs:
version:
description: 'The image version of the current ECS task definition'
value: ${{ jobs.get_version.outputs.version }}
jobs:
get_names:
name: Build Names
runs-on: ubuntu-latest
steps:
- name: Build Task Name
id: build_task_name
if: ${{ github.event.inputs.task-definition-name == '' }}
uses: WalletConnect/ci_workflows/.github/actions/build-task-name@main
with:
task-region: ${{ inputs.aws-region }}
task-name-stage: ${{ inputs.task-name-stage }}
task-name: ${{ inputs.task-name }}
- name: Build Container Name
id: build_container_name
if: ${{ github.event.inputs.container-name == '' }}
uses: WalletConnect/ci_workflows/.github/actions/build-task-name@main
with:
task-region: ${{ inputs.aws-region }}
task-name-stage: ${{ inputs.task-name-stage }}
task-name: ${{ inputs.task-name }}
- id: result
run: |
echo "task-name=${{ inputs.task-definition-name != '' && inputs.task-definition-name || steps.build_task_name.outputs.name }}" >> "$GITHUB_OUTPUT"
echo "container-name=${{ inputs.container-name != '' && inputs.container-name || steps.build_container_name.outputs.name }}" >> "$GITHUB_OUTPUT"
outputs:
task-name: ${{ steps.result.outputs.task-name }}
container-name: ${{ steps.result.outputs.container-name }}
get_version:
name: Lookup ECS
needs: [ get_names ]
runs-on: ${{ inputs.run-label }}
steps:
- name: Get task definition from ECS
id: get_task
uses: WalletConnect/actions/aws/ecs/get-task-image/@2.5.3
with:
aws-role-arn: ${{ inputs.aws-role-arn }}
aws-region: ${{ inputs.aws-region }}
task-definition-name: ${{ needs.get_names.outputs.task-name }}
container-name: ${{ needs.get_names.outputs.container-name }}
outputs:
version: ${{ steps.get_task.outputs.tag }}
display_version:
name: Version ➠ ${{ needs.get_version.outputs.version }}
needs: [ get_version ]
runs-on: ${{ inputs.run-label }}
steps:
- run: echo "Version = ${{ needs.get_version.outputs.version }}"