ci: add GitHub Actions workflow for GitHub Pages deployment#6314
ci: add GitHub Actions workflow for GitHub Pages deployment#6314Anexus5919 wants to merge 1 commit intosugarlabs:masterfrom
Conversation
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hi @walterbender @pikurasa @FirePheonix , this PR adds a CI/CD pipeline for automated GitHub Pages deployment, addressing #4284. I've reviewed the previous attempts (#4285, #4290, #4472) and their discussions, and this PR takes a different approach using the modern actions/deploy-pages workflow instead of the legacy gh-pages branch method. This avoids the token issues and branch management complexity that affected the earlier PRs. What it does: Runs Jest tests on every push to master, deployment is blocked if tests fail I've tested this on my fork and all jobs passed successfully. Would appreciate a review when you get a chance! |
|
@Anexus5919 nice improvement to modernize the Pages deployment workflow, using |
|
Thanks for the review @mahesh-09-12! Good question. The original issue (#4284) specifically requests automatic deployment on push to That said, the workflow already has safety layers to prevent unintended deployments:
Since only maintainers can merge to |
|
@Anexus5919 thanks for the detailed context, that helps. Looking back at #4290, it seems there were some challenges around deployment behavior and configuration, and maintainers were still evaluating the approach at that time. given that history, it might be worth confirming that the current setup avoids those earlier pitfalls (especially around permissions and deployment consistency), otherwise, the overall approach here looks solid. |
|
Good point @mahesh-09-12. Here's how this PR specifically avoids the pitfalls from the earlier attempts: Permissions (the #4285/#4290 PAT issue): Deployment consistency (the #4290 branch/scope issues): That said, the workflow is also flexible, if maintainers prefer manual-only deployments, the |
|
@walterbender @pikurasa @omsuneri Just wanted to flag an alternative deployment strategy for your consideration. Currently the workflow deploys automatically on every push to However, if you'd prefer more explicit control, I can switch the trigger to release-tag-only deploys meaning the site only updates when a tag like This way, PRs merge to That said, given Music Blocks serves static files and Jest tests already gate the deploy, auto-deploy on push to |
|
we have a GSOC project on this same feature. |
Oh yeah! This PR addresses the same idea that is now listed under GSoC in Sugar Labs. I had opened it way before but forgot to close it. Since I’ve already submitted a GSoC proposal for this idea, I’ll close this PR. |
Summary
Adds a CI/CD pipeline that automatically deploys Music Blocks to GitHub Pages on every push to
master, with Jest test gating to prevent broken deployments.Closes #4284
PR Category
Approach
Uses the modern GitHub Actions Pages deployment (
actions/deploy-pages) instead of the legacy gh-pages branch approach. This is cleaner, avoids branch management complexity, and provides proper deployment environments with history and rollback in the GitHub UI.Workflow structure
Key design decisions
pushtomaster+workflow_dispatch(manual) — PRs do not trigger deploymentsugarlabs/musicblocks, preventing forks from wasting runner minutesnpm ciis needed in the deploy job — keeps the artifact leanactions/checkout@v4,npm ci— matching all existing workflowsOne-time admin prerequisite
After merging, a repo admin must change the Pages source:
Settings → Pages → Build and deployment → Source → "GitHub Actions"
This is a one-time, 10-second change. The workflow includes a comment documenting this requirement.
Prior work
This issue has had three previous PRs, all closed by the stale bot due to inactivity:
secrets.GH_TOKENinstead ofGITHUB_TOKEN)maininstead ofmasterand used the error-prone gh-pages branch approachThis PR incorporates the lessons from all three: correct branch (
master), proper token handling (GITHUB_TOKENvia permissions), test gating, and a modern deployment approach that avoids the gh-pages branch issues entirely.Test plan
yaml-lintScreenshots:

