Refactor: Zitadel (#6826)

This commit is contained in:
Slaviša Arežina
2025-08-14 22:53:45 +02:00
committed by GitHub
parent 1c5ff8b26a
commit bc52b1a7d7
2 changed files with 8 additions and 17 deletions

View File

@@ -27,27 +27,24 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/zitadel/zitadel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt | grep -oP '\d+\.\d+\.\d+')" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
if [[ ! -f ~/.zitadel ]] || [[ "${RELEASE}" != "$(cat ~/.zitadel)" ]]; then
msg_info "Stopping $APP"
systemctl stop zitadel
msg_ok "Stopped $APP"
rm -f /usr/local/bin/zitadel
fetch_and_deploy_gh_release "zitadel" "zitadel/zitadel" "prebuild" "latest" "/usr/local/bin" "zitadel-linux-amd64.tar.gz"
msg_info "Updating $APP to ${RELEASE}"
cd /tmp
curl -fsSL "https://github.com/zitadel/zitadel/releases/download/v$RELEASE/zitadel-linux-amd64.tar.gz" | tar -xz
mv zitadel-linux-amd64/zitadel /usr/local/bin
$STD zitadel setup --masterkeyFile /opt/zitadel/.masterkey --config /opt/zitadel/config.yaml --init-projections=true
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to ${RELEASE}"
msg_info "Starting $APP"
systemctl start zitadel
msg_ok "Started $APP"
msg_info "Cleaning Up"
rm -rf /tmp/zitadel-linux-amd64
msg_ok "Cleanup Completed"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"