Guides

Promote from staging to production

Copy what one Hollware publishes to another as drafts and one review, read only what changed since the last time, and see what changed there meanwhile.

Promote from staging to production

hollware promote copies what one Hollware publishes, such as staging, to another, such as production. It writes drafts in the destination and asks for one review that publishes them together and unpublishes what the source no longer publishes. A person approves it there.

Run it

Each side needs a personal token of its site: content:read on the source; content:read and content:write on the destination, and content:publish for --publish.

npx hollware promote --from https://staging.example.com --from-token-file staging.token \
  --to https://cms.example.com --to-token-file production.token --dry-run

--dry-run prints the plan, one line per entry, and writes nothing, the state included:

create     docs/en/sign-in
update     docs/en/cli  (changed in the destination since the last promotion)
unchanged  docs/en/introduction
unpublish  docs/en/old-page
Dry run: 1 to create, 1 to update, 1 unchanged, 1 changed in the destination, 1 to unpublish. Nothing was written, the state neither.

Without it, the command writes the drafts and asks for the review, then says its id: approve it in the admin of the destination to publish.

What it promotes

  • Entries are matched by collection, locale and slug. The destination needs every collection and locale it receives: the command names the ones missing and writes nothing.
  • Only published entries are read, as they are published.
  • The images the entries show are copied when the destination lacks them.
  • An entry the source no longer publishes is unpublished by the same review. A review always publishes an entry, so an unpublication alone waits for the next promotion with an entry to publish, or for --publish.
  • A review holds up to 100 changes; more go to more reviews, and the command lists them.

Narrow it with --collection (repeat it for several), --locale and --tag.

Only what changed

The state file, .hollware/promote-<from>-<to>.json, keeps where each collection stopped and what was promoted. The next run asks the source only for what changed since (list_entries with changedSince). --since <time> reads from an ISO 8601 time instead, --all reads every published entry, and --state <file> keeps the state elsewhere. Commit the file, or keep it where your CI keeps its cache.

A review from the last run that is still pending keeps its entries: they are not asked for again. A review that was cancelled gives its entries to the next one.

Changed in the destination

The state remembers the revision and the SHA-256 of what was promoted. An entry whose published revision and Markdown in the destination both differ from those was changed there since the last promotion. It is still promoted, and the review carries a comment on it, anchored to the lines that differ, with the difference: the person who approves decides, or leaves it out of the approval.

Publish at once

--publish publishes in the destination instead of asking for a review, and unpublishes what the source no longer publishes. An entry changed in the destination still goes to a review, with its comment.

--json prints one JSON object and nothing else: the plan, the reviews, how many were published and unpublished, what waits, and the state file.