perrotuerto.blog/scripts/update.sh

31 lines
605 B
Bash
Raw Normal View History

2023-06-25 16:05:15 -06:00
JSON=public/perro.json
# Va a la raíz del repo
cd $(dirname $0)/..
2023-06-26 13:58:06 -06:00
# Actualiza el repo
git pull
2023-06-25 16:05:15 -06:00
# Limpia sitio
2023-06-26 10:29:22 -06:00
if [ -d "public" ]; then rm -rf public; fi
2023-06-25 16:05:15 -06:00
mkdir public
cp -r src/* public
rm public/*.*
# Descarga info de GitLab
curl --request GET \
-s -o $JSON \
-H "Authorization: Token $(<.token)" \
"https://linkding.cuates.net/api/bookmarks/?q=%23blog"
# Rehace sitio y JSON
python3 ./scripts/make.py $JSON
# Hace commit al repo si hubo cambios
2023-06-26 13:35:10 -06:00
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Actualización"
git push origin
git push cuates
fi