From d1b0752e36153afb142ee46aa13c7c38f703ae74 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Fri, 1 Mar 2024 10:14:31 +0100 Subject: [PATCH] simplify page build --- .github/workflows/build.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00be83ff..e4a3bb6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,14 +19,23 @@ env: TARGET_BRANCH: "gh-pages" CNAME: "coderefinery.org" -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: write jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository and submodules - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - name: Install zola @@ -51,20 +60,8 @@ jobs: echo -n ${{ env.CNAME }} > public/CNAME echo "Used CNAME from the action workflow file" fi - - name: Debug info - env: - event_name: ${{ github.event_name }} - ref: ${{ github.ref }} - run: | - echo event_name: "${event_name}" - echo github.ref: "${ref}" - - name: multipages - uses: rkdarst/gh-pages-multibranch@main - if: ${{ github.event_name == 'push' }} - with: - directory: public - name: Deploy to gh-pages - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) }} uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }}