美文网首页
雨果 hugo github 自动部署 .sh

雨果 hugo github 自动部署 .sh

作者: 辣辣不乖 | 来源:发表于2020-07-18 17:23 被阅读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" 更改生成靜態文件目錄

相关文章

网友评论

      本文标题:雨果 hugo github 自动部署 .sh

      本文链接:https://www.haomeiwen.com/subject/melrkktx.html