Fix htaccess for NPM
All checks were successful
Deploy (stellaamor) / deploy (push) Successful in 2s

This commit is contained in:
edsea
2025-10-08 16:10:37 +02:00
parent 9217a71d5a
commit 1b4adde2bb
2 changed files with 47 additions and 2 deletions

View File

@@ -0,0 +1,47 @@
# manual rollback
on:
workflow_dispatch:
inputs:
steps:
description: "How many releases to roll back (1 = previous)"
default: "1"
jobs:
rollback:
runs-on: [ mainhost ]
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY_PATH: /home/gitea-runner/.ssh/id_ed25519
SSH_OPTS: >-
-F /dev/null -o IdentitiesOnly=yes -o IdentityAgent=none
-o PreferredAuthentications=publickey -o PubkeyAuthentication=yes
-o PasswordAuthentication=no -o NumberOfPasswordPrompts=0 -o BatchMode=yes
-o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o ConnectTimeout=20
-o StrictHostKeyChecking=no
APP_ROOT: /var/www/stellaamor
SERVICE_RELOAD: "systemctl reload apache2 || true"
steps:
- name: Roll back symlink to an older release
run: |
set -euo pipefail
APP="${{ env.APP_ROOT }}"
RELEASES="${APP}/releases"
CUR="${APP}/current"
N="${{ github.event.inputs.steps || '1' }}"
# pick target release (1=previous)
TARGET="$(ls -1tr "${RELEASES}" | tail -n +"$((N+1))" | tail -n 1)"
if [ -z "${TARGET}" ]; then
echo "No release found to roll back to."; exit 1
fi
echo "Rolling back to: ${TARGET}"
ssh $SSH_OPTS -i "$SSH_KEY_PATH" ${SSH_USER}@${SSH_HOST} "
set -euo pipefail
APP='${APP}'; RELEASES='${RELEASES}'; CUR='${CUR}'; TARGET='${TARGET}';
[ -d \"\${RELEASES}/\${TARGET}\" ] || { echo 'Target release missing'; exit 1; }
ln -sfn \"\${RELEASES}/\${TARGET}\" \"\${CUR}\"
${SERVICE_RELOAD} >/dev/null 2>&1 || true
"

View File

@@ -2,8 +2,6 @@
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Add trailing slash to URLs (except files and directories)
RewriteCond %{REQUEST_FILENAME} !-f