# new 命令创建一个新的网站,会在当前目录生成站点文件夹hugo new site my_website
cd my_website
# 初始化 git 库git init
# 把主题仓库作为你的网站目录的子模块git clone https://github.com/HEIGE-PCloud/DoIt.git themes/DoIt
# 新建文章页面,位于 content/posts 目录hugo new posts/my-first-post.md
# 本地运行站点。-D 等于 --buildDrafts,包含草稿;--disableFastRender 完全重新渲染;-e 等于 --environment 运行环境,hugo server 默认是 development,而 production 会开启评论系统, CDN 等特性hugo server -D --disableFastRender -e production
# This is a basic workflow to help you get started with Actionsname:Deploy Pages# Controls when the action will run. on:# Triggers the workflow on push or pull request events but only for the main branchpush:branches:- main# Set a branch name to trigger deployment# Allows you to run this workflow manually from the Actions tabworkflow_dispatch:# Allow one concurrent deploymentconcurrency:group:${{ github.ref }}cancel-in-progress:true# A workflow run is made up of one or more jobs that can run sequentially or in paralleljobs:# This workflow contains a single job called "build"deploy:# The type of runner that the job will run onruns-on:ubuntu-latest# Steps represent a sequence of tasks that will be executed as part of the jobsteps:# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it- name:Checkoutuses:actions/checkout@v3with:submodules:recursive # Fetch Hugo themes (true OR recursive)fetch-depth:0# Fetch all history for .GitInfo and .Lastmod# Runs a single command using the runners shell- name:Setup Hugouses:peaceiris/actions-hugo@v2with:hugo-version:'0.111.3'extended:true# Runs a set of commands using the runners shell- name:Buildrun:| hugo \
--gc \
--minify \
--baseURL "https://example.pages.dev/"- name:Deployuses:peaceiris/actions-gh-pages@v3with:deploy_key:${{ secrets.YOUR_DEPLOY_KEY }}external_repository:github-name/your-repositorypublish_branch:mainpublish_dir:./public