From c1e125dc4fbec4241afde6925e62a44e114a0c1d Mon Sep 17 00:00:00 2001
From: Nemo <commits@captnemo.in>
Date: Sat, 01 Jul 2023 13:20:08 +0530
Subject: [PATCH] [ci] Use pages builds

---
 .github/workflows/pages.yml | 46 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index fccd196..63e6f40 100644
--- a/.github/workflows/pages.yml
+++ a/.github/workflows/pages.yml
@@ -1,5 +1,5 @@
+# Based on https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
 name: publish
-
 on:
   push:
     branches:
@@ -9,26 +9,52 @@
     # Runs at 8:09 UTC = 13:39 IST
     # Runs at 12:09 UTC = 17:39 IST
     - cron: '09 8,12 * * *'
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+  contents: read
+  pages: write
+  id-token: write
 
+# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
+# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
+concurrency:
+  group: "pages"
+  cancel-in-progress: false
+
 jobs:
-  publish:
+  # Build
+  build:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
       - run: php generate.php
         name: Set current Year
+      # WIP
+      # - name: Install curl-impersonate deps
+      #   run: apt-get install --yes libnss3 nss-plugin-pem ca-certificates
+      # - name: Download libcurl-impersonate
+      #   run: wget "https://github.com/lwthiker/curl-impersonate/releases/download/v0.5.4/libcurl-impersonate-v0.5.4.x86_64-linux-gnu.tar.gz" && \
+      #     tar -xvf libcurl-impersonate-v0.5.4.x86_64-linux-gnu.tar.gz
       - uses: ruby/setup-ruby@v1
         with:
           ruby-version: "3.0"
           bundler-cache: true
       - name: Generate RSS Feeds
         run: bundle exec weneedfeed build --base-url="https://captnemo.in/npci-rss-feeds"
-      - uses: peaceiris/actions-gh-pages@v3
-        name: Publish to GitHub Pages
+      - name: Upload artifact
+        # Automatically uploads an artifact from the './_site' directory by default
+        uses: actions/upload-pages-artifact@64bcae551a7b18bcb9a09042ddf1960979799187 # v1.0.8
         with:
-          github_token: ${{ secrets.GITHUB_TOKEN }}
-          publish_dir: output
-          user_name: 'github-actions[bot]'
-          user_email: 'github-actions[bot]@users.noreply.github.com'
-          force_orphan: true
-          commit_message: Automatic Update+          path: "output/"
+  # Deployment job
+  deploy:
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    runs-on: ubuntu-latest
+    needs: build
+    steps:
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@ee48c7b82e077d7b8ef30b50a719e6a792a50c9a # v2.0.2--
rgit 0.1.5