Repository navigation
ci(github): redeploy the demo and the docs after a merge to main that changes them - #50
Merged
Merged
Conversation
… changes them After agris:check passes on a push to main, a deploy job asks moon which tasks the push affects: it redeploys the demo when infra:demo-deploy's inputs changed (the runtime code its Workers are built from), and the docs when website:build's or infra:docs-deploy's inputs changed. A push that changes neither deploys nothing. A manual run deploys both. The Cloudflare credentials come from the repository's cloudflare environment, which only main may use. Closes #49
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49
What changed
.github/workflows/check.yml: adds adeployjob. It runs aftercheckpasses, on a push tomainor a manual run. It asks moon which tasks the push affects (moon query affectedfromgithub.event.beforeto the pushed commit), then deploys:infra:demo-deployis affected;website:buildorinfra:docs-deployis affected, building the site first;The job uses the
cloudflareenvironment and runs one deploy at a time without cancelling one in progress. It fails with a clear error if a credential is missing.infra/moon.yml:infra:demo-deploydeclares the runtime code the demo's Workers are built from as itsinputs, andinfra:docs-deploydeclares its stack files. These lists are the only path rules: the workflow keeps none of its own.AGENTS.md,docs/deploy.md: say that CI redeploys the maintainer's stages, and which token permissions it needs.Two traps the workflow avoids, both checked locally:
CI=true, moon silently skips arunInCI: "skip"task, so the deploy steps run the samealchemy deploy … --stage demo|docs --yescommands directly. The tasks keeprunInCI: "skip", so a straymoon cinever deploys.moon query affectedwaits to read changed files from stdin and hangs, so the workflow closes stdin (< /dev/null).How it was reproduced
Not a bug. To check the path rules, I replayed the job's decision with this branch's moon inputs over the last 16 merges to
main:Website-only merges (#25, #26, #36) deploy only the docs. Process-only merges (#43, #46) deploy nothing. Runtime merges deploy both, because the site renders runtime facts (cache windows, limits) through
@group(agris-sources).This PR changes neither stage's inputs, so merging it deploys nothing. The deploy itself is first exercised by a manual run once
CLOUDFLARE_API_TOKENis set (see below).Credentials
cloudflareenvironment exists, onlymainmay deploy to it, and it holdsCLOUDFLARE_ACCOUNT_ID.CLOUDFLARE_API_TOKEN. The local OAuth sign-ins (Alchemy and Wrangler) are refused by Cloudflare's token endpoints (9109 Unauthorized), and Alchemy's own token command needs the account's Global API Key. The token has to be created in the dashboard with Workers Scripts edit, Account Settings read and Secrets Store edit.Checks
moon run agris:checkpasses on this branchagris:check(not a stack)