All checks were successful
Deploy explore / deploy (push) Successful in 2s
Git als root in /opt/explore setzt safe.directory, damit der Checkout nicht an uid 501 scheitert. Co-authored-by: Cursor <cursoragent@cursor.com>
65 lines
2.2 KiB
YAML
65 lines
2.2 KiB
YAML
# Sync Explor.Code.Law nach /opt/explore
|
|
# Gitea Secret: SSH_PRIVATE_KEY
|
|
#
|
|
# Schlankes Daten-Deploy: nur Git-Checkout, kein Docker.
|
|
# Kein git clean / kein reset --hard — ge_xml/ und .env bleiben.
|
|
|
|
name: Deploy explore
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: explore-deploy
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: python:3.13-bookworm
|
|
steps:
|
|
- name: Deploy to Server
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: 82.165.92.92
|
|
username: root
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
command_timeout: 15m
|
|
script: |
|
|
set -euo pipefail
|
|
echo "Starting explore deployment..."
|
|
mkdir -p /opt/explore
|
|
chown root:root /opt/explore
|
|
cd /opt/explore
|
|
# rsync vom Mac setzt uid 501 — Git als root braucht safe.directory
|
|
export GIT_CONFIG_COUNT=1
|
|
export GIT_CONFIG_KEY_0=safe.directory
|
|
export GIT_CONFIG_VALUE_0=/opt/explore
|
|
|
|
if [ ! -d .git ]; then
|
|
git init
|
|
git remote add origin https://git.coded.law/michaelkole/explore.git || true
|
|
fi
|
|
git remote set-url origin https://git.coded.law/michaelkole/explore.git
|
|
git fetch origin main
|
|
# Tracked Dateien aktualisieren. Kein reset --hard, kein git clean:
|
|
# ge_xml/ und .env bleiben unangetastet.
|
|
git checkout origin/main -- .
|
|
|
|
mkdir -p ge_md data ge_xml kommentar
|
|
chmod 600 .env 2>/dev/null || true
|
|
if [ ! -f .env ] && [ -f env.example ]; then
|
|
cp env.example .env
|
|
chmod 600 .env
|
|
fi
|
|
grep -q "^LAWGIT_ROOT=" .env 2>/dev/null || echo "LAWGIT_ROOT=/opt/lawgit" >> .env
|
|
grep -q "^DOMAIN=" .env 2>/dev/null || echo "DOMAIN=explore.coded.law" >> .env
|
|
|
|
echo "ge_md files: $(find ge_md -name '*.md' 2>/dev/null | wc -l)"
|
|
echo "index: $([ -f data/normen_index.json ] && wc -c < data/normen_index.json || echo missing) bytes"
|
|
echo "ge_xml files (local disk, not from git): $(find ge_xml -type f 2>/dev/null | wc -l)"
|
|
echo "Deployment complete!"
|