-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.bash
executable file
·81 lines (66 loc) · 1.81 KB
/
release.bash
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
#!/usr/bin/env bash
# author : Jeong Han Lee
# email : jeonghan.lee@gmail.com
# version : 0.0.4
declare -g SC_SCRIPT;
declare -g SC_TOP;
SC_SCRIPT="$(realpath "$0")";
SC_TOP="${SC_SCRIPT%/*}"
function pushd { builtin pushd "$@" > /dev/null || exit; }
function popd { builtin popd > /dev/null || exit; }
Debian10="debian10.yml"
Debian11="debian11.yml"
Debian12="debian12.yml"
CentOS7="centos7.yml"
Rocky8="rocky8.yml"
Rocky9="rocky9.yml"
#Sl7="sl7.yml"
Alma8="alma8.yml"
ACTION_PATH="${SC_TOP}/.github/workflows";
DEB_FILE="${ACTION_PATH}/${Debian10}";
DEB11_FILE="${ACTION_PATH}/${Debian11}";
DEB12_FILE="${ACTION_PATH}/${Debian12}";
CEN_FILE="${ACTION_PATH}/${CentOS7}";
ROC_FILE="${ACTION_PATH}/${Rocky8}";
ROC9_FILE="${ACTION_PATH}/${Rocky9}";
#SL7_FILE="${ACTION_PATH}/${Sl7}";
ALMA_FILE="${ACTION_PATH}/${Alma8}";
function yes_or_no_to_go
{
printf "> \n";
printf "> Default latest tag will be used.\n"
read -p ">> Do you want to continue (y/N)? " answer
case ${answer:0:1} in
y|Y )
printf ">> latest tag is going to be used...... ";
;;
* )
printf "> \n";
printf ">> Please use the difference tag as an input.\n";
printf ">> $SC_SCRIPT tag_name.\n";
exit;
;;
esac
}
function replace_tag
{
local tag="$1"; shift;
local file="$1"; shift;
sed -i.bak -e "s| DOCKER_TAG:.*$| DOCKER_TAG: ${tag}|g" "${file}"
}
input_tag="$1";
if [ -z "$input_tag" ]; then
input_tag="latest";
yes_or_no_to_go;
fi
pushd "$SC_TOP" || exit
replace_tag "${input_tag}" "${DEB11_FILE}"
replace_tag "${input_tag}" "${DEB12_FILE}"
replace_tag "${input_tag}" "${CEN_FILE}"
replace_tag "${input_tag}" "${ROC_FILE}"
replace_tag "${input_tag}" "${ROC9_FILE}"
#replace_tag "${input_tag}" "${SL7_FILE}"
replace_tag "${input_tag}" "${ALMA_FILE}"
popd || exit
#git diff
exit