generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·55 lines (41 loc) · 1.25 KB
/
entrypoint.sh
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
#!/bin/sh -l
SOURCE_FILE=$1
YAML_PROPERTIES=$2
EXPORT_TO_CI_ENV=$3
EXPORT_TO_CI_OUTPUTS=$4
EXPORT_TO_ENV_FILE=$5
ENV_FILE=$6
PREFIX=$7
echo "SOURCE_FILE: $SOURCE_FILE"
echo "YAML_PROPERTIES: $YAML_PROPERTIES"
echo "EXPORT_TO_CI_ENV: $EXPORT_TO_CI_ENV"
echo "EXPORT_TO_CI_OUTPUTS: $EXPORT_TO_CI_OUTPUTS"
echo "EXPORT_TO_ENV_FILE: $EXPORT_TO_ENV_FILE"
echo "ENV_FILE: $ENV_FILE"
echo "PREFIX: $PREFIX"
#YQ_PATH=$1 /usr/bin/yq 'eval(strenv(YQ_PATH))' .cicd/metadata.yaml
#echo $2
for i in $YAML_PROPERTIES
do
echo "Now processing... $i"
echo $i
# Splitting the string into key and value
key=$(echo $i | cut -d '=' -f 1)
value=$(echo $i | cut -d '=' -f 2)
echo "Key: $key"
echo "Value: $value"
YQ_RESULT=$(YQ_PATH=$value /usr/bin/yq 'eval(strenv(YQ_PATH))' "${SOURCE_FILE}" )
echo $YQ_RESULT
if [ "$EXPORT_TO_CI_ENV" = "true" ]; then
echo "Exporting to CI env"
echo "${PREFIX}${key}=$YQ_RESULT" >> $GITHUB_ENV
fi
if [ "$EXPORT_TO_CI_OUTPUTS" = "true" ]; then
echo "Exporting to CI outputs"
echo "$key=$YQ_RESULT" >> $GITHUB_OUTPUT
fi
if [ "$EXPORT_TO_ENV_FILE" = "true" ]; then
echo "Exporting to env file"
echo "${PREFIX}${key}=$YQ_RESULT" >> $ENV_FILE
fi
done