Update tinyauth update procedure

This commit is contained in:
tremor021 2025-04-24 18:17:38 +02:00
parent 39f6bc9477
commit ee0c9421da
2 changed files with 10 additions and 3 deletions

View File

@ -31,8 +31,13 @@ function update_script() {
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating tinyauth" msg_info "Updating tinyauth"
$STD service tinyauth stop
temp_file=$(mktemp)
cp /opt/tinyauth/.env /opt
rm -rf /opt/tinyauth
mkdir -p /opt/tinyauth
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz -o $temp_file curl -fsSL "https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1 tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1
cd /opt/tinyauth/frontend cd /opt/tinyauth/frontend
$STD bun install $STD bun install
@ -41,10 +46,12 @@ function update_script() {
cd /opt/tinyauth cd /opt/tinyauth
$STD go mod download $STD go mod download
CGO_ENABLED=0 go build -ldflags "-s -w" CGO_ENABLED=0 go build -ldflags "-s -w"
cp /opt/.env /opt/tinyauth
rm -f "$temp_file"
msg_ok "Updated tinyauth" msg_ok "Updated tinyauth"
msg_info "Restarting tinyauth" msg_info "Restarting tinyauth"
$STD rc-service tinyauth restart $STD service tinyauth start
msg_ok "Restarted tinyauth" msg_ok "Restarted tinyauth"
exit 0 exit 0

View File

@ -25,7 +25,7 @@ temp_file=$(mktemp)
$STD npm install -g bun $STD npm install -g bun
mkdir -p /opt/tinyauth mkdir -p /opt/tinyauth
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz -o $temp_file curl -fsSL "https://github.com/steveiliop56/tinyauth/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1 tar -xzf "$temp_file" -C /opt/tinyauth --strip-components=1
cd /opt/tinyauth/frontend cd /opt/tinyauth/frontend
$STD bun install $STD bun install