Hugo博客一建自动部署以及本地备份
August 30, 2024 · 442 words · One minute
. find ./bilibytes.github.io -mindepth 1 ! -name ".git" ! -name "CNAME" ! -path "./bilibytes.github.io .git/*" -exec rm -rf {} + python3 backup_website_in_html.py hugo cd bilibytes.github.io git init git remote add origin https://github.com/bilibytes/bilibytes.github.io.git git add . git commit -m "$(date)" git pull --rebase origin main git push --set-upstream origin main import os import re import markdown import requests from pathlib import Path import shutil import yaml from urllib.parse import urlparse def extract_metadata_and_content(markdown_content):