Publish the built site to a pages branch for Ken's server to serve (#27)
CI / test (pull_request) Successful in 39s
CI / test (pull_request) Successful in 39s
Every push to main builds the static site (npm run build -> dist/) and force-pushes it as the only commit of the `pages` branch. Ken's web server serves that branch (a git-sync sidecar or a pull on a timer): nothing on his server needs a secret, since the repository is public, and the site updates within minutes of every merge, data PRs included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# The published Atlas page. Every push to main builds the static site (npm run build -> dist/) and force-pushes it
|
||||
# as the single commit of the `pages` branch. Ken's server serves that branch as plain files (a web server whose
|
||||
# folder is kept in step with the branch: a git-sync sidecar, or `git pull` on a timer). The repository is public,
|
||||
# so his server needs no token. Only the build output is on `pages`, never the raw data.
|
||||
#
|
||||
# Secrets: ATLAS_BOT_TOKEN (as in update-sources.yml), to push the branch.
|
||||
name: Publish the site (pages branch)
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm run build
|
||||
- name: Push dist/ as the pages branch
|
||||
env:
|
||||
ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
||||
run: |
|
||||
cd dist
|
||||
git init -q -b pages
|
||||
git config user.name "Atlas data bot"
|
||||
git config user.email "atlas-bot@noreply.localhost"
|
||||
git add -A
|
||||
git commit -q -m "site built from ${GITHUB_SHA::8}"
|
||||
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.https://git.kenschiano.net/.extraheader" \
|
||||
GIT_CONFIG_VALUE_0="AUTHORIZATION: token $ATLAS_BOT_TOKEN" \
|
||||
git push -q -f "https://git.kenschiano.net/${GITHUB_REPOSITORY}.git" pages
|
||||
echo "pages branch updated from ${GITHUB_SHA::8}"
|
||||
Reference in New Issue
Block a user