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