Add deploy.sh and update AGENTS.md with cross-machine workflow
This commit is contained in:
33
deploy.sh
Executable file
33
deploy.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REMOTE_USER="accusys"
|
||||
REMOTE_HOST="m5max128.local"
|
||||
REMOTE_DIR="~/momentry_portal"
|
||||
|
||||
if ! git diff --quiet --cached; then
|
||||
echo ":: Unstaged changes detected. Stage or stash them first."
|
||||
echo " git add -A && git stash"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo ":: Uncommitted changes found."
|
||||
if [ $# -ge 1 ]; then
|
||||
git add -A && git commit -m "$*"
|
||||
else
|
||||
git add -A && git commit -m "deploy: $(date '+%Y-%m-%d %H:%M')"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ":: Pushing to Gitea..."
|
||||
git push
|
||||
|
||||
echo ":: Deploying to ${REMOTE_HOST}..."
|
||||
ssh "${REMOTE_USER}@${REMOTE_HOST}" \
|
||||
"export PATH=\"\$HOME/.local/bin:\$PATH\" && eval \"\$(fnm env --use-on-cd)\" && \
|
||||
cd ${REMOTE_DIR} && \
|
||||
git pull && \
|
||||
npm run build"
|
||||
|
||||
echo ":: Done"
|
||||
Reference in New Issue
Block a user