perrotuerto.blog/scripts/update.sh

28 lines
546 B
Bash

JSON=public/perro.json
# Va a la raíz del repo
cd $(dirname $0)/..
# Limpia sitio
rm -rf public
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
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Actualización"
git push origin
git push cuates
fi