From a93555ca781f6bfff16a7119ba60724e5b6b4446 Mon Sep 17 00:00:00 2001 From: Anthony Byansi <101401469+AnthonyByansi@users.noreply.github.com> Date: Sun, 30 Jun 2024 11:10:22 +0300 Subject: [PATCH 1/5] Setup GitHub Actions to auto-publish README to GitHub Pages --- .github/ISSUE_TEMPLATE/workflows/deploy.yaml | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/workflows/deploy.yaml diff --git a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml new file mode 100644 index 0000000..e7a90e5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml @@ -0,0 +1,34 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + paths: + - README.md + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Generate index.html from README + run: | + echo 'README' > index.html + cat README.md | markdown >> index.html + echo '' >> index.html + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ + keep_files: false From 2dc2ad4c83693aa2529c72341d2ba097b198d458 Mon Sep 17 00:00:00 2001 From: Anthony Byansi <101401469+AnthonyByansi@users.noreply.github.com> Date: Sun, 30 Jun 2024 11:15:20 +0300 Subject: [PATCH 2/5] Renamed the job to `build-and-deploy` to avoid reserved keywords --- .github/ISSUE_TEMPLATE/workflows/deploy.yaml | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml index e7a90e5..d4a0629 100644 --- a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml +++ b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml @@ -8,27 +8,27 @@ on: - README.md jobs: - deploy: + build-and-deploy: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: '16' + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' - - name: Generate index.html from README - run: | - echo 'README' > index.html - cat README.md | markdown >> index.html - echo '' >> index.html + - name: Convert README to HTML + run: | + echo 'README' > index.html + cat README.md | markdown >> index.html + echo '' >> index.html - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./ - keep_files: false + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ + keep_files: false From 03819b09d682637e8b3b14b5e375309e5a99876c Mon Sep 17 00:00:00 2001 From: Anthony Byansi <101401469+AnthonyByansi@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:08:58 +0300 Subject: [PATCH 3/5] Refactor github actions workflow to use only first-party actions for github pages deployment --- .github/ISSUE_TEMPLATE/workflows/deploy.yaml | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml index d4a0629..1c8b107 100644 --- a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml +++ b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml @@ -26,9 +26,21 @@ jobs: cat README.md | markdown >> index.html echo '' >> index.html - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./ - keep_files: false + path: index.html + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build-and-deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 14109baada1f6d3edf8d169295420157db7c865e Mon Sep 17 00:00:00 2001 From: Anthony Byansi <101401469+AnthonyByansi@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:48:46 +0300 Subject: [PATCH 4/5] Add Permissions and concurrency settings --- .github/ISSUE_TEMPLATE/workflows/deploy.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml index 1c8b107..faca88c 100644 --- a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml +++ b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml @@ -6,10 +6,18 @@ on: - main paths: - README.md - + +permissions: + contents: read + pages: write + id-token: write + jobs: build-and-deploy: runs-on: ubuntu-latest + concurrency: + group: "pages" + cancel-in-progress: true steps: - name: Checkout repository From 8e73a8b39b2e5fdf772429743223531e80d3e0ae Mon Sep 17 00:00:00 2001 From: Anthony Byansi <101401469+AnthonyByansi@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:58:45 +0300 Subject: [PATCH 5/5] resolve yaml keyword issues --- .github/ISSUE_TEMPLATE/workflows/deploy.yaml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml index faca88c..cae3109 100644 --- a/.github/ISSUE_TEMPLATE/workflows/deploy.yaml +++ b/.github/ISSUE_TEMPLATE/workflows/deploy.yaml @@ -6,15 +6,14 @@ on: - main paths: - README.md - -permissions: - contents: read - pages: write - id-token: write - + jobs: build-and-deploy: runs-on: ubuntu-latest + + permissions: + contents: read + concurrency: group: "pages" cancel-in-progress: true @@ -48,6 +47,15 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build-and-deploy + + permissions: + pages: write + id-token: write + + concurrency: + group: "pages" + cancel-in-progress: true + steps: - name: Deploy to GitHub Pages id: deployment