Skip to content

Article update: Manjaro 系统配置.md #20

Article update: Manjaro 系统配置.md

Article update: Manjaro 系统配置.md #20

name: build-on-Github-Pages
# 在 master 分支更新时触发构建
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
permissions: # actions/deploy-pages@v2 需要
pages: write
id-token: write
env:
TZ: Asia/Shanghai
SOURCE_REPO: "he-sb/tech" # 博客源码仓库
steps:
# 配置 git,避免一些莫名其妙的错误
- name: Git Configuration
run: |
git config --global core.quotePath false
git config --global core.autocrlf false
git config --global core.safecrlf true
git config --global core.ignorecase false
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# 拉取源码
- name: Clone Repository
run:
git clone --branch=master --quiet https://github.com/$SOURCE_REPO site
# 安装 hugo
- name: Setup Hugo
env:
HUGO_VERSION: 0.118.2 # hugo 版本号
run: |
wget -q -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-amd64.deb && \
sudo dpkg -i hugo.deb && \
hugo version
# 构建
- name: Build
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run:
cd site && hugo --gc --minify --cleanDestinationDir
# 上传构建结果
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: site/public/
name: 'github-pages'
# 部署至 GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
env:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
uses: actions/deploy-pages@v2