From f66441452a73b6146e463282b153cceb13d1b785 Mon Sep 17 00:00:00 2001 From: Mehrad Mahmoudian Date: Thu, 18 Jan 2024 10:35:29 +0200 Subject: [PATCH] [updated the CI to the latest and also fixed some bugs --- .github/workflows/build.yml | 39 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e3e5e0..f69859f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,45 +3,34 @@ name: Zola on GitHub Pages on: push: branches: - - master - - dev-docs + - main pull_request: - + jobs: build: runs-on: ubuntu-latest - if: github.ref != 'refs/heads/master' + if: github.ref != 'refs/heads/main' steps: - - name: Checkout master - uses: actions/checkout@v3.0.0 - - name: Build only - uses: shalzz/zola-deploy-action@v0.16.1-1 + - name: Checkout main + uses: actions/checkout@v4 + - name: Build only + uses: shalzz/zola-deploy-action@v0.18.0 env: BUILD_DIR: . BUILD_ONLY: true BUILD_FLAGS: --drafts - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + # 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' + if: github.ref == 'refs/heads/main' steps: - - name: Checkout master - uses: actions/checkout@v3.0.0 + - name: Checkout main + uses: actions/checkout@v4 - name: Build and deploy - uses: shalzz/zola-deploy-action@v0.16.1-1 + uses: shalzz/zola-deploy-action@v0.18.0 env: BUILD_DIR: . PAGES_BRANCH: gh-pages GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Deploy developer docs - working-directory: ${{github.workspace}} - run: | - git config user.name "GitHub Actions" - git config user.email "github-actions-bot@users.noreply.github.com" - - git fetch origin gh-pages:gh-pages developer-docs:developer-docs - git checkout gh-pages - git cherry-pick developer-docs || true - git remote add destination "https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git" - git push destination gh-pages