Skip to content

Commit f4e90e7

Browse files
edenoclaude
andcommitted
ci: auto-deploy to GitHub Pages on push to main
Add a `deploy` job to the Test Suite workflow that publishes the built site to the gh-pages branch on every push/merge to main. Gated on the `build` and `e2e` jobs (build itself needs `test`), so the live app is never republished from a red commit. `integration` (schema-sync vs trodes_to_nwb) is intentionally not a gate so an upstream-repo change can't block shipping an unrelated fix. Reuses the artifact the `build` job uploaded (byte-identical to what passed CI, no second unverified build) and pushes it with peaceiris/actions-gh-pages, matching the manual `npm run deploy` (gh-pages -d build). Pages serves this repo from the gh-pages branch, so it redeploys automatically after the push. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a279bd8 commit f4e90e7

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,38 @@ jobs:
168168
name: build
169169
path: build/
170170
retention-days: 7
171+
172+
deploy:
173+
name: Deploy to GitHub Pages
174+
runs-on: ubuntu-latest
175+
# Gate on a green build (which itself `needs: test`, so lint + tests passed)
176+
# AND the e2e suite, so the live app is never republished from a red commit.
177+
# `integration` (schema-sync vs trodes_to_nwb main) is intentionally NOT a
178+
# gate: it can fail because the upstream repo changed, which must not block
179+
# shipping an unrelated fix.
180+
needs: [build, e2e]
181+
# Only on a real push/merge to main — never on PRs (which would publish
182+
# unmerged code). PRs to main still run test/build/e2e, just no deploy.
183+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
184+
permissions:
185+
contents: write # required to push the built site to the gh-pages branch
186+
concurrency:
187+
group: deploy-gh-pages
188+
cancel-in-progress: false # let an in-flight deploy finish; queue the next
189+
steps:
190+
- name: Download production build
191+
# Reuse the exact bundle the `build` job compiled and uploaded, so what
192+
# ships is byte-identical to what passed CI (no second, unverified build).
193+
uses: actions/download-artifact@v4
194+
with:
195+
name: build
196+
path: build
197+
198+
- name: Publish to gh-pages branch
199+
# GitHub Pages serves this repo from the gh-pages branch ("Deploy from a
200+
# branch"), matching the manual `npm run deploy` (gh-pages -d build). This
201+
# pushes the downloaded build/ there; Pages then redeploys automatically.
202+
uses: peaceiris/actions-gh-pages@v4
203+
with:
204+
github_token: ${{ secrets.GITHUB_TOKEN }}
205+
publish_dir: ./build

0 commit comments

Comments
 (0)