Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b37e1aae6c | |||
7076829747 | |||
1387ca262b | |||
684f034aee |
@@ -152,6 +152,29 @@ jobs:
|
||||
echo "Release notes:"
|
||||
cat /tmp/release_notes.md
|
||||
|
||||
- name: Delete existing release if it exists
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
|
||||
echo "Checking for existing release $VERSION..."
|
||||
|
||||
# Try to get existing release by tag
|
||||
EXISTING_RELEASE_ID=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/serve.zone/nupst/releases/tags/$VERSION" \
|
||||
| jq -r '.id // empty')
|
||||
|
||||
if [ -n "$EXISTING_RELEASE_ID" ]; then
|
||||
echo "Found existing release (ID: $EXISTING_RELEASE_ID), deleting..."
|
||||
curl -X DELETE -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://code.foss.global/api/v1/repos/serve.zone/nupst/releases/$EXISTING_RELEASE_ID"
|
||||
echo "Existing release deleted"
|
||||
sleep 2
|
||||
else
|
||||
echo "No existing release found, proceeding with creation"
|
||||
fi
|
||||
|
||||
- name: Create Gitea Release
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@serve.zone/nupst",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"exports": "./mod.ts",
|
||||
"tasks": {
|
||||
"dev": "deno run --allow-all mod.ts",
|
||||
|
16
install.sh
16
install.sh
@@ -243,11 +243,15 @@ if [ -d "$INSTALL_DIR" ]; then
|
||||
|
||||
echo "Updating existing installation at $INSTALL_DIR..."
|
||||
|
||||
# Check if service is running and stop it
|
||||
# Check if service exists (enabled or running) and stop it if active
|
||||
if systemctl is-enabled --quiet nupst 2>/dev/null || systemctl is-active --quiet nupst 2>/dev/null; then
|
||||
SERVICE_WAS_RUNNING=1
|
||||
if systemctl is-active --quiet nupst 2>/dev/null; then
|
||||
echo "Stopping NUPST service..."
|
||||
systemctl stop nupst
|
||||
SERVICE_WAS_RUNNING=1
|
||||
else
|
||||
echo "Service is installed but not currently running (will be updated)..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clean up old Node.js installation files
|
||||
@@ -340,6 +344,14 @@ fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Update systemd service file if migrating from v3
|
||||
if [ $SERVICE_WAS_RUNNING -eq 1 ] && [ $OLD_NODE_INSTALL -eq 1 ]; then
|
||||
echo "Updating systemd service file for v4..."
|
||||
$BINARY_PATH service enable > /dev/null 2>&1
|
||||
echo "Service file updated."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Restart service if it was running before update
|
||||
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
|
||||
echo "Restarting NUPST service..."
|
||||
|
@@ -15,17 +15,17 @@ export class NupstSystemd {
|
||||
|
||||
/** Template for the systemd service file */
|
||||
private readonly serviceTemplate = `[Unit]
|
||||
Description=Node.js UPS Shutdown Tool for Multiple UPS Devices
|
||||
Description=NUPST - Deno-powered UPS Monitoring Tool
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/nupst/bin/nupst daemon-start
|
||||
ExecStart=/usr/local/bin/nupst service start-daemon
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
User=root
|
||||
Group=root
|
||||
Environment=PATH=/usr/bin:/usr/local/bin
|
||||
Environment=NODE_ENV=production
|
||||
WorkingDirectory=/tmp
|
||||
WorkingDirectory=/opt/nupst
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Reference in New Issue
Block a user