-
-
Notifications
You must be signed in to change notification settings - Fork 334
Fix/docs #1924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix/docs #1924
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,20 +10,38 @@ jobs: | |||||||||||||
| if: ${{ github.repository == 'commitizen-tools/commitizen' && !startsWith(github.event.head_commit.message, 'bump:') }} | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| name: "Bump version and create changelog with commitizen" | ||||||||||||||
| permissions: | ||||||||||||||
| contents: write | ||||||||||||||
| actions: write | ||||||||||||||
| steps: | ||||||||||||||
| - name: Check out | ||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||
| with: | ||||||||||||||
| fetch-depth: 0 | ||||||||||||||
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | ||||||||||||||
| - name: Create bump and changelog | ||||||||||||||
| uses: commitizen-tools/commitizen-action@master | ||||||||||||||
| with: | ||||||||||||||
| github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||||||||||||||
| changelog_increment_filename: body.md | ||||||||||||||
| fetch-tags: true | ||||||||||||||
| - uses: commitizen-tools/setup-cz@main | ||||||||||||||
| - id: bump-version | ||||||||||||||
| run: | | ||||||||||||||
| cz bump --yes | ||||||||||||||
| git push --follow-tags | ||||||||||||||
| new_version="$(cz version -p)" | ||||||||||||||
| echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||||||||||||||
| new_version_tag="$(cz version -p --tag)" | ||||||||||||||
| echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT | ||||||||||||||
| - name: Build changelog for Release | ||||||||||||||
| env: | ||||||||||||||
| NEW_VERSION: ${{ steps.bump-version.outputs.new_version }} | ||||||||||||||
| run: | | ||||||||||||||
| cz changelog --dry-run "${NEW_VERSION}" > .changelog.md | ||||||||||||||
|
Comment on lines
+33
to
+35
|
||||||||||||||
| NEW_VERSION: ${{ steps.bump-version.outputs.new_version }} | |
| run: | | |
| cz changelog --dry-run "${NEW_VERSION}" > .changelog.md | |
| NEW_VERSION_TAG: ${{ steps.bump-version.outputs.new_version_tag }} | |
| run: | | |
| cz changelog --dry-run --unreleased-version "${NEW_VERSION_TAG}" > .changelog.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,11 @@ on: | |||||
| push: | ||||||
| tags: | ||||||
| - "v*" | ||||||
| workflow_dispatch: | ||||||
| inputs: | ||||||
| version: | ||||||
| description: "Version to trigger" | ||||||
| required: true | ||||||
|
|
||||||
| jobs: | ||||||
| deploy: | ||||||
|
|
@@ -15,8 +20,8 @@ jobs: | |||||
| steps: | ||||||
| - uses: actions/checkout@v6 | ||||||
| with: | ||||||
| token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | ||||||
| fetch-depth: 0 | ||||||
| ref: ${{ inputs.version || github.ref_name }} | ||||||
|
||||||
| ref: ${{ inputs.version || github.ref_name }} | |
| ref: ${{ github.event.inputs.version || github.ref_name }} |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,94 +30,6 @@ The version follows the `MAJOR.MINOR.PATCH` format, with increments determined b | |||||
| | `MINOR` | New features | `feat` | | ||||||
| | `PATCH` | Fixes and improvements | `fix`, `perf`, `refactor`| | ||||||
|
|
||||||
| ### `--version-scheme` | ||||||
|
|
||||||
| By default, Commitizen uses [PEP 440][pep440] for version formatting. You can switch to semantic versioning using either: | ||||||
|
|
||||||
| 1. Command line: | ||||||
| ```sh | ||||||
| cz bump --version-scheme semver | ||||||
| ``` | ||||||
|
|
||||||
| 2. Configuration file: | ||||||
| ```toml title="pyproject.toml" | ||||||
| [tool.commitizen] | ||||||
| version_scheme = "semver" | ||||||
| ``` | ||||||
|
|
||||||
| Available options are: | ||||||
|
|
||||||
| - `pep440`: [PEP 440][pep440] (**default** and recommended for Python projects) | ||||||
| - `semver`: [Semantic Versioning][semver] (recommended for non-Python projects) | ||||||
|
|
||||||
| You can also set this in the configuration file with `version_scheme = "semver"`. | ||||||
|
|
||||||
| !!! note | ||||||
| [pep440][pep440] and [semver][semver] are quite similar, although their difference lies in | ||||||
| how the prereleases look. For example, `0.3.1a0` in pep440 is equivalent to `0.3.1-a0` in semver. | ||||||
|
|
||||||
| The following table illustrates the difference between the two schemes: | ||||||
|
|
||||||
| | Version Type | pep440 | semver | | ||||||
| |--------------|----------------|-----------------| | ||||||
| | Non-prerelease | `0.1.0` | `0.1.0` | | ||||||
| | Prerelease | `0.3.1a0` | `0.3.1-a0` | | ||||||
| | Devrelease | `0.1.1.dev1` | `0.1.1-dev1` | | ||||||
| | Dev and pre | `1.0.0a3.dev1` | `1.0.0-a3-dev1` | | ||||||
|
|
||||||
|
|
||||||
| !!! note "Incomplete Version Handling" | ||||||
| Commitizen treats a three-part version (major.minor.patch) as complete. | ||||||
| If your configured version is incomplete (for example, `1` or `1.2`), Commitizen pads missing parts with zeros when it needs `major/minor/patch` for tag formatting. | ||||||
| The tag output depends on your `tag_format`: formats using `${version}` keep `1`/`1.2`, while formats using `${major}.${minor}.${patch}` will render `1.0.0`/`1.2.0`. | ||||||
|
|
||||||
| When bumping from an incomplete version, Commitizen looks for the latest existing tag that matches the provided release prefix. | ||||||
| For example, if the current version is `1.2` and the latest `1.2.x` tag is `1.2.3`, then a patch bump yields `1.2.4` and a minor bump yields `1.3.0`. | ||||||
|
|
||||||
| !!! tip | ||||||
| To control the behaviour of bumping and version parsing, you may implement your own `version_scheme` by inheriting from `commitizen.version_schemes.BaseVersion` or use an existing plugin package. | ||||||
|
|
||||||
|
|
||||||
| ### PEP440 Version Examples | ||||||
|
|
||||||
| Commitizen supports the [PEP 440][pep440] version format, which includes several version types. Here are examples of each: | ||||||
|
|
||||||
| #### Standard Releases | ||||||
| ```text | ||||||
| 0.9.0 # Initial development release | ||||||
| 0.9.1 # Patch release | ||||||
| 0.9.2 # Another patch release | ||||||
| 0.9.10 # Tenth patch release | ||||||
| 0.9.11 # Eleventh patch release | ||||||
| 1.0.0 # First stable release | ||||||
| 1.0.1 # Patch release after stable | ||||||
| 1.1.0 # Minor feature release | ||||||
| 2.0.0 # Major version release | ||||||
| ``` | ||||||
|
|
||||||
| #### Pre-releases | ||||||
| ```text | ||||||
| 1.0.0a0 # Alpha release 0 | ||||||
| 1.0.0a1 # Alpha release 1 | ||||||
| 1.0.0b0 # Beta release 0 | ||||||
| 1.0.0rc0 # Release candidate 0 | ||||||
| 1.0.0rc1 # Release candidate 1 | ||||||
| ``` | ||||||
|
|
||||||
| #### Development Releases | ||||||
| ```text | ||||||
| 1.0.0.dev0 # Development release 0 | ||||||
| 1.0.0.dev1 # Development release 1 | ||||||
| ``` | ||||||
|
|
||||||
| #### Combined Pre-release and Development | ||||||
| ```text | ||||||
| 1.0.0a1.dev0 # Development release 0 of alpha 1 | ||||||
| 1.0.0b2.dev1 # Development release 1 of beta 2 | ||||||
| ``` | ||||||
|
|
||||||
| > **Note**: `post` releases (e.g., `1.0.0.post1`) are not currently supported. | ||||||
|
|
||||||
| ## Command line options | ||||||
|
|
||||||
|  | ||||||
|
|
@@ -176,7 +88,7 @@ For example, if the current version is `1.0.0b1` then bumping with `--prerelease | |||||
| Applies the exact changes that have been specified with `--increment` or determined from the commit log. | ||||||
| For example, `--prerelease beta` will always result in a `b` tag, and `--increment PATCH` will always increase the patch component. | ||||||
|
|
||||||
| #### Examples | ||||||
| **Examples** | ||||||
|
|
||||||
| The following table illustrates the difference in behavior between the two modes: | ||||||
|
|
||||||
|
|
@@ -525,6 +437,100 @@ Automatically answers “yes” to all interactive prompts during the bump proce | |||||
| cz bump --yes | ||||||
| ``` | ||||||
|
|
||||||
| ### `--version-scheme` | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved it to the bottom, to have a cohesive view of the Eventually, |
||||||
|
|
||||||
| Format used for the version. | ||||||
|
|
||||||
| **Available options** | ||||||
|
|
||||||
| - `pep440`: [PEP 440][pep440]: recommended for Python projects, **default** (for legacy reasons) | ||||||
| - `semver2`: [Semantic Versioning v2][semver]: recommended for non-Python projects | ||||||
| - `semver`: [Semantic Versioning v1](https://semver.org/spec/v1.0.0.html): use if you are stuck with semver v1 | ||||||
|
|
||||||
| **Examples** | ||||||
|
|
||||||
| 1. Command line: | ||||||
| ```sh | ||||||
| cz bump --version-scheme semver | ||||||
|
||||||
| cz bump --version-scheme semver | |
| cz bump --version-scheme semver2 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,28 +77,36 @@ cz changelog --extra key=value -e short="quoted value" | |||||
|
|
||||||
| ### `--file-name` | ||||||
|
|
||||||
| This value can be updated in the configuration file with the key `changelog_file` under `tool.commitizen`. | ||||||
|
|
||||||
| Specify the name of the output file. Note that changelog generation only works with Markdown files. | ||||||
|
|
||||||
| ```bash | ||||||
| cz changelog --file-name="CHANGES.md" | ||||||
| ``` | ||||||
|
|
||||||
| This value can be updated in the configuration file with the key `changelog_file` under `tool.commitizen`. | ||||||
|
|
||||||
| ```toml | ||||||
| [tool.commitizen] | ||||||
| # ... | ||||||
| changelog_file = "CHANGES.md" | ||||||
| ``` | ||||||
|
|
||||||
| ### `--incremental` | ||||||
|
|
||||||
| This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen` | ||||||
| Build from the latest version found in changelog. | ||||||
|
|
||||||
| Benefits: | ||||||
|
|
||||||
| - Build from the latest version found in changelog. This is useful if you have an existing changelog and want to use commitizen to extend it. | ||||||
| - Useful if you have an existing changelog and want to use commitizen to extend it. | ||||||
| - Update unreleased area | ||||||
| - Allows users to manually edit the changelog without it being completely rewritten. | ||||||
|
|
||||||
| ```bash | ||||||
| cz changelog --incremental | ||||||
| ``` | ||||||
|
|
||||||
| This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen` | ||||||
|
||||||
| This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen` | |
| This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen`. |
Uh oh!
There was an error while loading. Please reload this page.