Create docs-publish.yml

This commit is contained in:
ForgQi authored and GitHub committed 2024-01-17 22:02:35 +08:00
1 parent c220773828
commit becafefe3d
1 file changed
+38
+38
View File
@@ -0,0 +1,38 @@
name: Zola on GitHub Pages
on:
push:
branches:
- master
paths:
- docs/**
pull_request:
jobs:
build:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Build only
uses: shalzz/zola-deploy-action@v0.18.0
env:
BUILD_DIR: docs
BUILD_ONLY: true
BUILD_FLAGS: --drafts
# A GitHub token is not necessary when BUILD_ONLY is true
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_and_deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Build and deploy
uses: shalzz/zola-deploy-action@v0.18.0
env:
BUILD_DIR: docs
PAGES_BRANCH: gh-pages
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}