build: fix remote-upgrade-grav; add remote plugin-update, git-sync toggle, content-status targets
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Np4cMQLF77i664CAQXySzU
This commit is contained in:
@@ -20,8 +20,9 @@ SITE_CONFIG_DIR ?= $(REMOTE_HOME)/site-config
|
|||||||
# make remote-install-prod → runs remote-install with ENV=prod
|
# make remote-install-prod → runs remote-install with ENV=prod
|
||||||
# Calling a bare remote target (no ENV) fails via guard-env.
|
# Calling a bare remote target (no ENV) fails via guard-env.
|
||||||
REMOTE_TARGETS := remote-env-setup remote-env-remove remote-wipe remote-install \
|
REMOTE_TARGETS := remote-env-setup remote-env-remove remote-wipe remote-install \
|
||||||
remote-fetch remote-fetch-content remote-install-plugins remote-upgrade-grav \
|
remote-fetch remote-fetch-content remote-install-plugins remote-update-plugins \
|
||||||
remote-clean remote-maintenance-on remote-maintenance-off
|
remote-upgrade-grav remote-git-sync-disable remote-git-sync-enable \
|
||||||
|
remote-content-status remote-clean remote-maintenance-on remote-maintenance-off
|
||||||
ENVS := test prod
|
ENVS := test prod
|
||||||
|
|
||||||
guard-env:
|
guard-env:
|
||||||
@@ -144,9 +145,20 @@ remote-fetch-content: guard-env
|
|||||||
remote-install-plugins: guard-env
|
remote-install-plugins: guard-env
|
||||||
$(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
|
$(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
|
||||||
|
|
||||||
|
remote-update-plugins: guard-env
|
||||||
|
$(SSH) "cd $(WEBROOT) && php bin/gpm update -y && php bin/grav cache"
|
||||||
|
|
||||||
remote-upgrade-grav: guard-env
|
remote-upgrade-grav: guard-env
|
||||||
$(SSH) "cd $(WEBROOT) && php bin/grav upgrade"
|
$(SSH) "cd $(WEBROOT) && php bin/gpm self-upgrade -y && php bin/grav cache"
|
||||||
|
|
||||||
|
remote-git-sync-disable: guard-env
|
||||||
|
$(SSH) "bash -s -- '$(WEBROOT)/user/config/plugins/git-sync.yaml' false" < scripts/git-sync-toggle.sh
|
||||||
|
|
||||||
|
remote-git-sync-enable: guard-env
|
||||||
|
$(SSH) "bash -s -- '$(WEBROOT)/user/config/plugins/git-sync.yaml' true" < scripts/git-sync-toggle.sh
|
||||||
|
|
||||||
|
remote-content-status: guard-env
|
||||||
|
$(SSH) "cd $(WEBROOT)/user && git status --short && echo '--- config diff ---' && git diff -- config/"
|
||||||
|
|
||||||
remote-clean: guard-env
|
remote-clean: guard-env
|
||||||
$(SSH) "cd $(WEBROOT) && php bin/grav clearcache"
|
$(SSH) "cd $(WEBROOT) && php bin/grav clearcache"
|
||||||
|
|||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
FILE="$1"
|
||||||
|
STATE="$2"
|
||||||
|
: "${FILE:?usage: git-sync-toggle.sh <git-sync.yaml path> <true|false>}"
|
||||||
|
: "${STATE:?usage: git-sync-toggle.sh <git-sync.yaml path> <true|false>}"
|
||||||
|
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
echo "ERROR: $FILE not found — is git-sync installed on this server?" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -qE '^enabled:' "$FILE"; then
|
||||||
|
sed -i -E "s/^enabled:.*/enabled: ${STATE}/" "$FILE"
|
||||||
|
else
|
||||||
|
printf 'enabled: %s\n' "$STATE" | cat - "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "git-sync now: $(grep -E '^enabled:' "$FILE")"
|
||||||
Reference in New Issue
Block a user