From 7ec89bcb3843f9f626000920ce138362dce93834 Mon Sep 17 00:00:00 2001 From: Andrew Gioia Date: Wed, 10 Dec 2025 10:47:39 -0500 Subject: [PATCH 1/3] Create initial Github actions workflow to build production docs --- .github/workflows/pages.yml | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..ebda066 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,55 @@ +name: Deploy Docs (Production) + +on: + push: + branches: + - master + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages-production + cancel-in-progress: true + +jobs: + build: + name: Build docs + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build docs site + run: npm run publish + + # upload the built docs as the GitHub Pages artifact + - name: Upload artifact for GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs + + deploy: + name: Deploy to GitHub Pages + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 From ae7fd11dc93e311c0a2ab398c6a3034d0d12dbad Mon Sep 17 00:00:00 2001 From: Andrew Gioia Date: Wed, 10 Dec 2025 10:51:23 -0500 Subject: [PATCH 2/3] Fixes rename script to not cause build to fail --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c5f0e23..1b2b17b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "sassmin": "sass sass/keyrune.scss css/keyrune.css --style=compressed", "watch": "sass --no-source-map --watch sass/keyrune.scss css/keyrune.css --style=expanded", "build": "rsync -avzh ./fonts/* ./docs/fonts/ && rsync -avzh css/keyrune.min.css docs/assets/keyrune.min.css", - "rename": "for f in `find fonts/*`; do mv -v \"$f\" \"`echo $f | tr '[A-Z]' '[a-z]'`\"; done", + "rename": "for f in fonts/*; do lower=$(echo \"$f\" | tr '[:upper:]' '[:lower:]'); if [ \"$f\" != \"$lower\" ]; then mv -v \"$f\" \"$lower\"; fi; done", "publish": "npm run less && npm run lessmin && npm run rename && npm run build" }, "ignore": [ @@ -52,4 +52,4 @@ "engines": { "node": "*" } -} +} \ No newline at end of file From df0e7ff45f9dd093e56cd58867c95e35d5c7c9ab Mon Sep 17 00:00:00 2001 From: Andrew Gioia Date: Wed, 10 Dec 2025 10:57:59 -0500 Subject: [PATCH 3/3] Adds PR preview handling workflow --- .github/workflows/pr.yml | 98 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..67eef91 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,98 @@ +name: Docs Preview (PR) + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - master + +permissions: + contents: read + pages: write + id-token: write + pull-requests: write + +concurrency: + group: docs-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build: + name: Build docs + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build docs (npm run publish) + run: npm run publish + + - name: Upload artifact for GitHub Pages + uses: actions/upload-pages-artifact@v3 + 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 + + comment: + name: Comment preview URL on PR + needs: deploy + 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 + + steps: + - name: Find existing docs preview comment + id: find-comment + uses: peter-evans/find-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: 'Keyrune docs preview' + + - name: Create or update docs preview comment + uses: peter-evans/create-or-update-comment@v5 + with: + comment-id: ${{ steps.find-comment.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + 🔍 **Keyrune docs preview** + + Preview URL: ${{ needs.deploy.outputs.page_url }} + + - Source branch: `${{ github.head_ref }}` + - Target branch: `${{ github.base_ref }}` + - Commit: `${{ github.sha }}` + - Workflow run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + _This comment will update automatically when new commits are pushed to this PR._ + edit-mode: replace \ No newline at end of file