Skip to content
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

Current release changelog with merged pre-release changelog #687

Closed
Apkawa opened this issue Mar 13, 2023 · 4 comments
Closed

Current release changelog with merged pre-release changelog #687

Apkawa opened this issue Mar 13, 2023 · 4 comments
Labels
type: feature A new enhacement proposal

Comments

@Apkawa
Copy link
Contributor

Apkawa commented Mar 13, 2023

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

@Apkawa Apkawa added the type: feature A new enhacement proposal label Mar 13, 2023
@Apkawa
Copy link
Contributor Author

Apkawa commented Mar 13, 2023

What do you think about this? I'm thinking of making a pull request with this feature.

@woile
Copy link
Member

woile commented Mar 18, 2023

I think is a good idea. One question though: do we want to merge-prereleases, or skip empty ones? What do you think would make more sense?

@Apkawa
Copy link
Contributor Author

Apkawa commented Mar 18, 2023

I think maybe separate flags

  1. skips empty prereleases, --skip-empty-prerelease , rest of logic as usual.
  2. collects all changes from prereleases to release, prereleases are not included in the log - --merge-prerelease. which is what I wrote above.

@woile
Copy link
Member

woile commented Apr 28, 2023

Flag has been added.
https://commitizen-tools.github.io/commitizen/changelog/#merge-prerelease

@woile woile closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new enhacement proposal
Projects
None yet
Development

No branches or pull requests

2 participants