init #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 构建到 gh-pages 分支 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
pages: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 更新 apt 源并安装 Zola | |
run: | | |
wget https://github.com/getzola/zola/releases/latest/download/zola_latest_amd64.deb | |
sudo dpkg -i zola_latest_amd64.deb | |
# 或者,如果有一个官方的 APT 源,可以直接使用: | |
# sudo add-apt-repository ppa:barnumbirr/zola-debian | |
# sudo apt-get update | |
# sudo apt-get install zola | |
- name: 构建 Zola 站点 | |
run: zola build | |
- name: 列出构建输出目录内容 | |
run: ls -la ./public | |
- name: 部署到 gh-pages 分支 | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
commit_message: 'Build and deploy to gh-pages' | |
publish_branch: gh-pages |