-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
81 lines (69 loc) · 2.17 KB
/
action.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
name: 'Werf Deployment Action'
description: 'Configures base runner with Taskfile, kubectl, werf, and runs Werf commands and Tasks.'
author: 'gbh-tech'
branding:
icon: 'book'
color: 'blue'
inputs:
werf_secret_key:
description: 'Werf secret key value'
default: ''
aws_region:
description: 'AWS Region'
required: true
aws_access_key_id:
description: 'AWS Access Key from Service Account'
required: true
aws_secret_access_key:
description: 'AWS service account secret access key'
required: true
environment:
description: 'Target environment'
required: true
tasks:
description: 'Tasks to run'
commands:
description: 'Werf commands to run'
runs:
using: 'composite'
steps:
- name: Configure AWS service account credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ inputs.aws_region }}
aws-access-key-id: ${{ inputs.aws_access_key_id }}
aws-secret-access-key: ${{ inputs.aws_secret_access_key }}
- name: Add Werf secret key
shell: bash -leo pipefail {0}
if: ${{ inputs.werf_secret_key != '' }}
run: echo "${{ inputs.werf_secret_key }}" > .werf_secret_key
- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Install Task
uses: arduino/setup-task@v2
with:
version: '3.x'
- name: Install Werf
uses: werf/actions/install@v2
- name: Running tasks defined in Taskfile
if: ${{ inputs.tasks != '' }}
shell: bash -leo pipefail {0}
run: |
tasks="${{ inputs.tasks }}"
# Set the IFS to comma (,) to split the string based on comma
IFS=','
read -ra array <<< "$tasks"
for task in ${array[@]}; do
task $task -- ${{ inputs.environment }}
done
- name: Running Werf commands
if: ${{ inputs.commands != '' }}
shell: bash -leo pipefail {0}
run: |
commands="${{ inputs.commands }}"
# Set the IFS to comma (,) to split the string based on comma
IFS=','
read -ra array <<< "$commands"
for command in ${array[@]}; do
werf $command --env ${{ inputs.environment }}
done