# `MishkaCmsCore.Runtime.Resources.Changes.PublishPageDraft`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__changes/publish_page_draft.ex#L5)

After a `:publish` / `:master_publish` of a `MishkaCmsCore.Runtime.PageDraft`, writes the
draft's fields to the live `MishkaCmsCore.Runtime.Page` — creating the page when the draft has
no `source_page_id`, otherwise updating the existing page.

The write is scoped to the draft's site (`tenant: draft.site_id`, `authorize?: false`), so it
behaves identically for master and tenant publishes and triggers the normal Page compile
pipeline (`Changes.SendToOban`). It runs in an `after_action`, so a Page write failure (e.g. a
duplicate path for a brand-new draft) rolls the whole publish transaction back and surfaces the
error.

An existing page keeps its own code — `MishkaCmsCore.Runtime.PageBuilder.CodeAccess.fields/0`. The
builder's code drawer writes it to the page directly, so a draft only holds the copy it forked.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
