Skip to content

Current release changelog with merged pre-release changelog #687

Description

@Apkawa

Description

in my case, in gh-actions manually called cz ch like this, as example:

cz changelog --dry-run 0.2.0a2 > CHANGELOG.txt

and use as body for gh-release .

Example:

$ git tag
v0.1.0 v0.2.0-a0
v0.2.0-a1
v0.2.0-a2

for the prerelease case, I use the current tag, like "0.2.0a2", that's fine.

but for release after all pre-releases i need to collect all commits between releases message like 0.2.0a0..0.2.0

at the moment it looks like this

$ cz ch 0.2.0a0..0.2.0 --dry-run
## v0.2.0 (2023-03-13)### Fix
- foo fix 3
## v0.2.0b0 (2023-03-13)## v0.2.0a1 (2023-03-13)### Fix
- some fix
## v0.2.0a0 (2023-03-13)### Feat
- super feature
## v0.1.0 (2023-03-13)

Possible Solution

I'm thinking about adding a flag for the merged prerelease commit in one release.
For example, --merge-prerelease

I want something like this:

$ cz ch 0.2.0a0..0.2.0 --dry-run --merge-prerelease
## v0.2.0 (2023-03-13)
### Fix
- foo fix 3
- some fix
### Feat
- super feature

In the case of a multi-release range 0.1.0..0.3.0, the output would be:

$ cz ch 0.1.0..0.3.0 --dry-run --merge-prerelease
## v0.3.0 (2023-03-13)
### Fix
- foo fix 3
- some fix
### Feat
- super feature
## v0.2.0 (2023-03-13)
### Feat
- feature
## v0.1.0 (2023-03-13)
### Feat
- feature foo

Additional context

This feature useful for gh-actions for me

 - name: Check version
uses: apkawa/gh-action-semver-check@master
id: version
- name: Generate Changelog
run: |
cz changelog --dry-run ${{ steps.version.outputs.full_with_prefix }}a0..${{ steps.version.outputs.full_with_prefix }} > ${{ github.workspace }}-CHANGELOG.txt
- name: Publish archives and packages
uses: softprops/action-gh-release@v1
if: ${{ !github.event.schedule && startsWith(github.ref, 'refs/tags') }}
with:
draft: true
prerelease: ${{ needs.version.outputs.prerelease }}
body_path: ${{ github.workspace }}-CHANGELOG.txt

In addition, you may need a special syntax for the range
Instead of 0.2.0a0..0.2.0 there will be, for example, ~0.2.0. This will make things easier

Additional context

#364

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions