registry-static
Publish your remotes to a static host and roll back by moving a pointer. Opt-in: pnpm mfeflow add registry-static.
What you get
- Scripts
registry:deploy,registry:rollbackandregistry:status, which run themfeflowcommands of the same name. docs/registry.mdin your project, with your host and the commands.- With
ci-githubin the project,.github/workflows/deploy.yml, which deploys every remote whenmainchanges.
The feature adds no runtime code. The commands are described in Deploying remotes.
When to use it
Use it when a folder or a bucket (S3, R2, MinIO) is enough to serve your remotes. If you need percentage rollouts or a kill switch, a static host cannot do that.
Add it
Run this in your project, with your own host:
You should see the three scripts and docs/registry.md in the list of changes. Leave the options out to set them later.
Use it
Deploy one remote to prod:
You should see prod now serves catalog@<version>. If something is wrong, go back:
You should see Rolled back from <version>. Nothing is rebuilt.
Options
The commands read registry.host and registry.baseUrl in mfeflow.json first, then these options. A flag beats both.
Credentials
Credentials are never written to a file. Locally, set them in your shell. In CI, they come from GitHub secrets:
How the workflow works
The deploy workflow is a separate file from the pull request checks, so a pull request never deploys.
- It runs on a push to
main, or by hand from the Actions tab with an environment name. - It installs, builds, then reads the remotes from
mfeflow.json. - For each remote it runs
mfeflow deploy. Deploys never run at the same time.
It is only generated when ci-github is already in the project. Add ci-github first.
Protect the registry environment
In the repository settings, open Environments, then registry. Allow deployments from the main branch only, and add required reviewers for prod. The deploy job also checks that it runs on main, so a manual run from another branch does nothing.
Gotchas
-
A remote whose files changed without a version bump fails its deploy. The other remotes still deploy, and the run fails at the end and lists the ones that failed.
-
Rollbacks reach people when their browser's copy of the index expires, up to 60 seconds. The bench measures the rest on a local host only.
-
GitHub Pages caches every file for 10 minutes and you cannot change that. A rollback there takes about 11 minutes.
-
Remotes get their version from
package.json. Thereleasefeature keeps that number in step with Changesets.