Skip to content

完全使用actions进行pages部署 #7

完全使用actions进行pages部署

完全使用actions进行pages部署 #7

Workflow file for this run

name: GitHub Pages Deploy
on:
push:
branches:
- main # 当 main 分支有新提交时触发部署
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read # 读取仓库内容
pages: write # 写入 GitHub Pages 部署内容
id-token: write # 用于身份验证的 ID 令牌
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true # 拉取主题子模块
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true # 使用 Hugo 扩展版
- name: Build site
run: hugo --minify # 生成静态站点,并最小化输出
- name: Upload artifact to Pages
uses: actions/upload-pages-artifact@v1
with:
path: ./public # Hugo 生成的静态文件目录
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
environment: github-pages

Check failure on line 41 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / GitHub Pages Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 41, Col: 7): Unexpected value 'environment'