雨果 hugo github 自动部署 .sh

2020-07-18  本文已影响0人  辣辣不乖

文件命名 deploy.sh

#!/bin/sh

# If a command fails then the deploy stops
set -e

printf "\033[0;32mDeploying updates to GitHub and Coding...\033[0m\n"

# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`

# Go To Public folder
cd public

# Add changes to git.
git add .

# Commit changes.
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
    msg="$*"
fi
git commit -m "$msg"

# Push source and build repos.
git push origin master

# Pull all .
# git fetch --all && git reset --hard origin/master && git pull

設置 true 生成靜態博客到 docs 文件夾,部署在GitHub Pages上時,一次性部署博客源碼與發佈博客
canonifyurls = false 相對路徑轉絕對路徑
publishDir = "docs" 更改生成靜態文件目錄

上一篇 下一篇

猜你喜欢

热点阅读