From becafefe3deb420d46a316d1c9b3b6caca7b6ac6 Mon Sep 17 00:00:00 2001 From: ForgQi <34411314+ForgQi@users.noreply.github.com> Date: Wed, 17 Jan 2024 22:02:35 +0800 Subject: [PATCH] Create docs-publish.yml --- .github/workflows/docs-publish.yml | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/docs-publish.yml diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml new file mode 100644 index 0000000..d199cd8 --- /dev/null +++ b/.github/workflows/docs-publish.yml @@ -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 }}