Reconfigures GH actions workflows for PR URL handling

This commit is contained in:
Andrew Gioia 2025-12-11 15:57:34 -05:00
parent 4d95480324
commit 0d7c3e2f49
Signed by: andrew
GPG Key ID: FC09694A000800C8
4 changed files with 19 additions and 38 deletions

View File

@ -7,22 +7,20 @@ on:
- master
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
contents: write # push to gh-pages
pull-requests: write # create/update PR comment
concurrency:
group: docs-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: Build docs
build-and-deploy-preview:
name: Build & deploy PR preview
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Setup Node
@ -34,41 +32,24 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build docs (npm run publish)
- name: Build docs
run: npm run publish
- name: Upload artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
- name: Deploy preview to gh-pages/pr-<number>/
uses: peaceiris/actions-gh-pages@v4
with:
path: ./docs
deploy:
name: Deploy PR preview
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages (preview)
id: deployment
uses: actions/deploy-pages@v4
with:
# mark this as a preview deployment for a PR
preview: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs
destination_dir: pr-${{ github.event.pull_request.number }}
keep_files: true
comment:
name: Comment preview URL on PR
needs: deploy
needs: build-and-deploy-preview
runs-on: ubuntu-latest
# only run if we actually got a URL, and only for same-repo PRs (forks have restricted tokens)
if: >
needs.deploy.outputs.page_url != '' &&
github.event.pull_request.head.repo.full_name == github.repository
# only for same-repo PRs (no forks)
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Find existing docs preview comment
@ -87,7 +68,7 @@ jobs:
body: |
🔍 **Keyrune docs preview**
Preview URL: ${{ needs.deploy.outputs.page_url }}
Preview URL: https://keyrune.andrewgioia.com/pr-${{ github.event.pull_request.number }}/
- Source branch: `${{ github.head_ref }}`
- Target branch: `${{ github.base_ref }}`

View File

@ -45,7 +45,7 @@
<div class="wrapper">
<section>
<h3>
View the full list of set and expansion symbols below, for all sets and special edition products up to <strong>Avatar: the Last Airbender</strong>. To use the symbols on your desktop or just get the vectors, check out the <a href="cheatsheet.html">Cheatsheet</a>.
View the full list of set and expansion symbols below, for all sets and special edition products up to <strong>Lorwyn Eclipsed and TMNT</strong>. To use the symbols on your desktop or just get the vectors, check out the <a href="cheatsheet.html">Cheatsheet</a>.
</h3>
<p style="margin: -15px 0 25px;">
<strong>Note:</strong> you can now link directly to a preview of each symbol's by adding the symbol code at the end of the url like this: <a href="https://keyrune.andrewgioia.com/icons.html?icon=ody">https://keyrune.andrewgioia.com/icons.html?icon=ody</a>.

View File

@ -43,7 +43,7 @@
</a>
</div>
<p>
Current version 3.17.1 includes all sets to Avatar: The Last Airbender.
Current version 3.18.0 includes all sets to Lorwyn Eclipsed.
</p>
</div>
</header>