Generate and validate the spec first
The publish job should consume the same OpenAPI file your build produces, not a separately maintained copy. Validate that generation succeeded and that the document includes the title, version, paths, and schemas consumers expect.
- Fail the workflow when generation or validation fails
- Publish only from the branch or environment that owns the reference
- Keep staging and production references on different slugs when they describe different contracts