2022-12-07 07:30:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2025-02-22 14:50:49 +00:00
|
|
|
# Automatically pull and commit changes to remote after generating Neuron static
|
|
|
|
# site
|
2022-12-07 07:30:05 +00:00
|
|
|
|
2025-02-22 14:52:14 +00:00
|
|
|
# USER=thomas
|
|
|
|
# export XDG_RUNTIME_DIR=/run/user/1000
|
|
|
|
# source /home/thomas/.env
|
2024-04-14 21:50:03 +01:00
|
|
|
|
2025-02-22 14:50:49 +00:00
|
|
|
SLACK_NOTIFIER="${HOME}/repos/utilities/slack_notifier.sh"
|
|
|
|
NEURON_GENERATOR="${HOME}/repos/neuron-zk-generator/dist/neuron-zk-generator"
|
2023-01-21 12:18:17 +00:00
|
|
|
|
2025-02-22 14:50:49 +00:00
|
|
|
cd "${HOME}/repos/eolas"
|
2022-12-07 07:30:05 +00:00
|
|
|
|
2024-02-26 19:06:05 +00:00
|
|
|
echo "Checking for changes..."
|
2023-01-21 13:50:33 +00:00
|
|
|
git pull >/dev/null 2>&1
|
2023-02-21 07:39:26 +00:00
|
|
|
changes_exist="$(git status --porcelain | wc -l)"
|
2022-12-07 07:30:05 +00:00
|
|
|
|
|
|
|
# If no changes, exit. Else commit and push with timestamp
|
2023-02-21 07:39:26 +00:00
|
|
|
if [ "$changes_exist" -eq 0 ]; then
|
2024-11-14 12:54:37 +00:00
|
|
|
echo "No changes, exiting"
|
|
|
|
exit 0
|
2022-12-07 07:30:05 +00:00
|
|
|
fi
|
|
|
|
|
2025-02-22 14:50:49 +00:00
|
|
|
# Run Neuron generator
|
|
|
|
$NEURON_GENERATOR
|
2024-03-09 19:47:02 +00:00
|
|
|
|
2024-02-26 19:10:38 +00:00
|
|
|
echo "Changes exist. Updating remote..."
|
2023-01-21 13:50:33 +00:00
|
|
|
git pull >/dev/null 2>&1
|
2022-12-07 07:30:05 +00:00
|
|
|
git add .
|
2022-12-09 08:30:05 +00:00
|
|
|
git commit -q -m "Autosave: $(date +"%Y-%m-%d %H:%M:%S")"
|
2023-01-21 13:51:23 +00:00
|
|
|
git push
|
2024-03-05 18:20:03 +00:00
|
|
|
|
2025-02-22 14:52:14 +00:00
|
|
|
$SLACK_NOTIFIER "eolas" 'success' 'eolas: auto-save executed'
|