Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d32ddb1734 | |||
|
|
324b577134 |
12
download-act_runner.sh
Normal file → Executable file
12
download-act_runner.sh
Normal file → Executable file
@@ -4,6 +4,18 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||
# shellcheck source=init.sh
|
||||
. "${BASE_FOLDER}init.sh";
|
||||
|
||||
download_file=$(curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||
jq ".assets[].browser_download_url" |\
|
||||
cut -d '"' -f 2 |\
|
||||
grep "${arch}$");
|
||||
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||
if [ -f "${download_folder}/${file}" ]; then
|
||||
echo "[!] File ${file} has already been downloaded";
|
||||
exit;
|
||||
fi;
|
||||
echo "act_runner version to download: ${version}";
|
||||
|
||||
cd "${download_folder}" || exit;
|
||||
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||
jq ".assets[].browser_download_url" |\
|
||||
|
||||
16
download.sh
16
download.sh
@@ -4,11 +4,21 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||
# shellcheck source=init.sh
|
||||
. "${BASE_FOLDER}init.sh";
|
||||
|
||||
cd "${download_folder}" || exit;
|
||||
curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
||||
download_file=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
||||
grep browser_download_url |\
|
||||
cut -d '"' -f 4 |\
|
||||
grep "${arch}$" |\
|
||||
grep "${arch}$");
|
||||
|
||||
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||
if [ -f "${download_folder}/${file}" ]; then
|
||||
echo "[!] File ${file} has already been downloaded";
|
||||
exit;
|
||||
fi;
|
||||
echo "gitea version to download: ${version}";
|
||||
|
||||
cd "${download_folder}" || exit;
|
||||
echo "${download_file}" |\
|
||||
xargs curl -LJO --output-dir "${download_folder}"
|
||||
cd - || exit;
|
||||
|
||||
|
||||
12
init.sh
12
init.sh
@@ -30,16 +30,18 @@ if [ ! -d "${download_folder}" ]; then
|
||||
exit;
|
||||
fi;
|
||||
target_file="/usr/local/bin/gitea";
|
||||
gitea_exists=1;
|
||||
if [ ! -f "${target_file}" ]; then
|
||||
echo "There is no gitea target file at ${target_file}. Is gitea installed?";
|
||||
exit;
|
||||
echo "[!] There is no gitea target file at ${target_file}. Is gitea installed?";
|
||||
gitea_exists=0;
|
||||
fi;
|
||||
target_file_act_runner="/usr/local/bin/act_runner";
|
||||
act_runner_exists=1
|
||||
if [ ! -f "${target_file_act_runner}" ]; then
|
||||
echo "There is no gitea action runner target file at ${target_file}. Is gitea action runner installed?";
|
||||
exit;
|
||||
echo "[!] There is no gitea action runner target file at ${target_file_act_runner}. Is gitea action runner installed?";
|
||||
act_runner_exists=0
|
||||
fi;
|
||||
|
||||
export arch target_file;
|
||||
export arch target_file gitea_exists act_runner_exists;
|
||||
|
||||
# __END__
|
||||
|
||||
@@ -17,7 +17,7 @@ echo -e "Update gitea action runner to ${1} ... ";
|
||||
systemctl stop act_runner;
|
||||
cp "${download_folder}act_runner-${1}-${arch}" "${target_file_act_runner}";
|
||||
chmod +x "${target_file_act_runner}";
|
||||
systemctl start gitea;
|
||||
systemctl start act_runner;
|
||||
echo "[DONE]";
|
||||
|
||||
# __END__
|
||||
|
||||
Reference in New Issue
Block a user