From 262fcd95f18e90dca17522ce2de4f07df6febedd Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 16 Feb 2024 13:12:22 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20misc(CI):=20improve=20CI=20to=20?= =?UTF-8?q?check=20and=20build=20for=20PRs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 44 +++++++++++++++++++++++++ .github/workflows/zolatogithubpages.yml | 18 ---------- 2 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/zolatogithubpages.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..44b69db --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: Build Site + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check_and_build_pr: + name: Check and Build for Pull Requests + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Zola Check + uses: shalzz/zola-deploy-action@v0.18.0 + env: + BUILD_ONLY: true + CHECK_LINKS: true + + - name: Zola Build + uses: shalzz/zola-deploy-action@v0.18.0 + env: + BUILD_ONLY: true + + build_and_deploy: + name: Build and Deploy on Main Push + runs-on: ubuntu-22.04 + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Build and Deploy + uses: shalzz/zola-deploy-action@v0.18.0 + env: + PAGES_BRANCH: gh-pages + TOKEN: ${{ secrets.TOKEN }} + BUILD_THEMES: false diff --git a/.github/workflows/zolatogithubpages.yml b/.github/workflows/zolatogithubpages.yml deleted file mode 100644 index a8933a0..0000000 --- a/.github/workflows/zolatogithubpages.yml +++ /dev/null @@ -1,18 +0,0 @@ -# On every push this script is executed -on: push -name: Build and deploy GH Pages -jobs: - build: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - steps: - - name: checkout - uses: actions/checkout@v3.0.0 - - name: build_and_deploy - uses: shalzz/zola-deploy-action@master - env: - # Target branch - PAGES_BRANCH: gh-pages - # Provide personal access token - TOKEN: ${{ secrets.TOKEN }} - BUILD_THEMES: false