From 03344a769d88d849e6e62a89a87f4396a0c703e8 Mon Sep 17 00:00:00 2001 From: Adrian Tombu Date: Tue, 23 Jul 2024 15:18:01 +0000 Subject: [PATCH 1/2] Check zola build on pull requests --- .github/workflows/pull-request.yml | 17 +++++++++++++++++ .github/workflows/zola.yml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..f8044c3 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,17 @@ +name: Pull request + +on: [ pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Zola + run: | + wget "https://github.com/getzola/zola/releases/download/v0.19.1/zola-v0.19.1-x86_64-unknown-linux-gnu.tar.gz" + sudo tar xzf ./zola-v0.19.1-x86_64-unknown-linux-gnu.tar.gz + + - name: Build + run: "export CURRENT_TIME=$(date '+%d %B %Y'); ./zola build" diff --git a/.github/workflows/zola.yml b/.github/workflows/zola.yml index 434a4f2..4971f8e 100644 --- a/.github/workflows/zola.yml +++ b/.github/workflows/zola.yml @@ -7,7 +7,7 @@ on: jobs: deploy: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 642a4c4a4172227f5f869f04fe177459482164dd Mon Sep 17 00:00:00 2001 From: Adrian Tombu Date: Tue, 23 Jul 2024 15:43:59 +0000 Subject: [PATCH 2/2] Use a single github action with conditional deploy --- .github/workflows/pull-request.yml | 17 ----------------- .github/workflows/zola.yml | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index f8044c3..0000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Pull request - -on: [ pull_request ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Zola - run: | - wget "https://github.com/getzola/zola/releases/download/v0.19.1/zola-v0.19.1-x86_64-unknown-linux-gnu.tar.gz" - sudo tar xzf ./zola-v0.19.1-x86_64-unknown-linux-gnu.tar.gz - - - name: Build - run: "export CURRENT_TIME=$(date '+%d %B %Y'); ./zola build" diff --git a/.github/workflows/zola.yml b/.github/workflows/zola.yml index 4971f8e..96fde01 100644 --- a/.github/workflows/zola.yml +++ b/.github/workflows/zola.yml @@ -4,9 +4,10 @@ on: push: branches: - gh-pages + pull_request: jobs: - deploy: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -19,6 +20,25 @@ jobs: - name: Build run: "export CURRENT_TIME=$(date '+%d %B %Y'); ./zola build" + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + if: ${{ github.ref == 'refs/heads/gh-pages' }} + with: + name: build_artifacts + path: public/ + + deploy: + if: ${{ github.ref == 'refs/heads/gh-pages' }} + + needs: build + + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build_artifacts + - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: