@@ -47,21 +47,115 @@ yarn test
4747- ` yarn ` – install dependencies
4848- ` yarn build-packages ` – compile all packages
4949
50- ## Publish a New Release
51-
52- 1 . ** Bump the version** (use semantic versioning):
53- ``` bash
54- yarn release:version < patch| minor| major>
55- ```
56- 2 . ** Update ` CHANGELOG.md ` ** by running:
57- ``` bash
58- yarn release:changelog
59- ```
60- Copy the output to the top of ` CHANGELOG.md ` with the current date. Update the "High level enhancements" section (high-level summary of new features or bug fixes) and clean up the history for public release.
61- 3 . ** Cleanup documentation** in ` README.md ` , ` packages/docusaurus-plugin-openapi-docs/README.md ` and ` demo/docs/intro.mdx ` .
62- 4 . ** Commit** all changes with the message ` Prepare release vX.Y.Z ` .
63-
64- Once merged, the ` release.yaml ` workflow will publish the release automatically.
50+ ## Versioning and Releases
51+
52+ This project uses [ semantic versioning] ( https://semver.org/ ) and Lerna for package management. Releases are triggered automatically when version changes are merged to ` main ` .
53+
54+ ### Version Types
55+
56+ | Bump Type | Example | When to Use |
57+ | ------------ | ------------------------------- | --------------------------------------- |
58+ | ` patch ` | ` 4.5.0 ` → ` 4.5.1 ` | Bug fixes, minor documentation updates |
59+ | ` minor ` | ` 4.5.1 ` → ` 4.6.0 ` | New features, non-breaking enhancements |
60+ | ` major ` | ` 4.6.0 ` → ` 5.0.0 ` | Breaking changes |
61+ | ` preminor ` | ` 4.5.1 ` → ` 4.6.0-rc.0 ` | Pre-release for upcoming minor version |
62+ | ` prerelease ` | ` 4.6.0-rc.0 ` → ` 4.6.0-rc.1 ` | Iterate on existing pre-release |
63+ | ` graduate ` | ` 4.6.0-rc.5 ` → ` 4.6.0 ` | Promote pre-release to stable |
64+ | ` betamajor ` | ` 4.5.1 ` → ` 5.0.0-beta.0 ` | Start a new beta major version |
65+ | ` betapatch ` | ` 5.0.0-beta.0 ` → ` 5.0.0-beta.1 ` | Iterate on beta version |
66+
67+ ### Preparing a Release
68+
69+ #### Step 1: Bump the Version
70+
71+ Run the version command with the appropriate bump type:
72+
73+ ``` bash
74+ yarn release:version < bump>
75+ ```
76+
77+ This updates ` lerna.json ` and all package versions. The version is stored in ` lerna.json ` and propagated to all packages.
78+
79+ #### Step 2: Generate the Changelog
80+
81+ ``` bash
82+ yarn release:changelog
83+ ```
84+
85+ This outputs a changelog template comparing commits between the latest tag and ` main ` . Copy the output and prepend it to ` CHANGELOG.md ` .
86+
87+ ** Changelog format:**
88+
89+ ``` markdown
90+ ## X.Y.Z (Mon DD, YYYY)
91+
92+ High level enhancements
93+
94+ - Brief summary of major features or fixes
95+
96+ Other enhancements and bug fixes
97+
98+ - Commit message ([ #123 ] ( https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/123 ) )
99+ ```
100+
101+ ** Guidelines for changelog entries:**
102+
103+ - Replace ` TODO HIGHLIGHTS ` with a concise summary of user-facing changes
104+ - Remove internal commits (CI changes, minor refactors) that don't affect users
105+ - Group related changes together when appropriate
106+ - Use past tense for descriptions
107+
108+ #### Step 3: Update Documentation (if needed)
109+
110+ Review and update version references in:
111+
112+ - ` README.md `
113+ - ` packages/docusaurus-plugin-openapi-docs/README.md `
114+ - ` demo/docs/intro.mdx `
115+
116+ #### Step 4: Commit and Open a PR
117+
118+ ``` bash
119+ git add .
120+ git commit -m " Prepare release vX.Y.Z"
121+ ```
122+
123+ Open a pull request targeting ` main ` . The PR title should follow the format: ` (release) vX.Y.Z ` .
124+
125+ ### Automatic Publishing
126+
127+ Once the release PR is merged to ` main ` , the ` release.yaml ` GitHub Action:
128+
129+ 1 . Checks if the version tag already exists (skips if it does)
130+ 2 . Installs dependencies and builds packages
131+ 3 . Publishes packages to npm
132+ 4 . Creates and pushes a git tag (` vX.Y.Z ` )
133+
134+ ** Important:** Do not manually publish or create tags. The workflow handles this automatically.
135+
136+ ### Beta Releases
137+
138+ Beta releases follow a separate workflow on the ` v3.0.0 ` branch (or other designated beta branches):
139+
140+ 1 . Use ` betamajor ` or ` betapatch ` to bump versions
141+ 2 . Generate changelog with ` yarn release:changelog `
142+ 3 . Merge to the beta branch
143+ 4 . The ` release-beta.yaml ` workflow publishes with the ` beta ` npm tag
144+
145+ Users install beta versions with:
146+
147+ ``` bash
148+ npm install docusaurus-plugin-openapi-docs@beta
149+ ```
150+
151+ ### Troubleshooting Releases
152+
153+ | Issue | Solution |
154+ | ------------------ | ------------------------------------------------------------------- |
155+ | Release skipped | Version tag already exists; bump to a new version |
156+ | Changelog empty | No commits between latest tag and main; verify remote is configured |
157+ | Publish failed | Check npm token in GitHub secrets (` NPM_AUTH_TOKEN ` ) |
158+ | Tag already exists | A previous release used this version; bump again |
65159
66160## Handling Issues and Pull Requests
67161
0 commit comments