From 32b300836d567f688e5b04a7361ed0e847af9445 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tau=20G=C3=A4rtli?= <git@tau.garden>
Date: Mon, 15 Jul 2024 20:19:02 +0200
Subject: [PATCH] Deploy to GitHub Pages directly via Action (#1555)

---
 .github/workflows/ci.yml | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 68fc33770..2515e26e0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -56,9 +56,22 @@ jobs:
         echo "Zola version: $(./zola --version)"
     - name: Zola build
       run: ./zola build
-    - name: Deploy
-      if: github.ref == 'refs/heads/source'
-      uses: crazy-max/ghaction-github-pages@v1
+    - name: Upload GitHub Pages artifact
+      uses: actions/upload-pages-artifact@v1
       with:
-        build_dir: public
-        target_branch: master
+        path: public
+  
+  pages:
+    needs: zola
+    permissions:
+      pages: write
+      id-token: write
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    runs-on: ubuntu-latest
+    if: format('refs/heads/{0}', github.event.repository.default_branch) == github.ref
+    steps:
+    - name: Deploy to GitHub Pages
+      id: deployment
+      uses: actions/deploy-pages@v4