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

[changelog] Changelog is generated even if an external file is specified #965

Closed
charphi opened this issue Sep 23, 2022 · 8 comments
Closed
Assignees
Labels
bug Something isn't working released Issue has been released
Milestone

Comments

@charphi
Copy link

charphi commented Sep 23, 2022

Steps to Reproduce

  1. Set an external changelog file in a GitHub release section

Expected Behaviour

No changelog should be generated.
JReleaser should check that the external file exists during dry-run.

Actual Behaviour

Changelog is generated.
JReleaser doesn't check that the external file exists during dry-run.

@charphi charphi added the bug Something isn't working label Sep 23, 2022
@aalmiray
Copy link
Member

aalmiray commented Sep 24, 2022

I can't replicate this error with JReleaser 1.2.0.

  1. git clone https://github.com/aalmiray/foobar.git
  2. edit jreleaser.yml so that the release section looks like this
release:
  github:
    overwrite: true
    sign: true
    discussionCategoryName: Announcements
    changelog:
      external: CHANGELOG.md
      preset: conventional-commits
      formatted: ALWAYS
      format: '- {{commitShortHash}} {{commitTitle}}'
      contributors:
        format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'
  1. Create a file named CHANGELOG.md at the root with
## Changelog

 - Fixed stuff
  1. Run jreleaser changelog -g
[INFO]  Project version set to 1.0.0
[INFO]  Release is not snapshot
[INFO]  Timestamp is 2022-09-24T14:57:11.769714-05:00
[INFO]  HEAD is at 4df324c
[INFO]  Platform is osx-x86_64
[INFO]  dry-run set to true
[INFO]  Reading changelog from CHANGELOG.md
[INFO]  Generating changelog: out/jreleaser/release/CHANGELOG.md
[DEBUG] ## Changelog

 - Fixed stuff


[INFO]  Calculating checksums
  1. Run jreleaser release --dry-run.

The changelog at out/jreleaser/release/CHANGELOG.md matches the content of CHANGELOG.md at the root.

@charphi
Copy link
Author

charphi commented Sep 27, 2022

In my config, I use the jreleaser-maven-plugin in a module of a multi-module Maven project.

The external changelog is located on parent/root project and is specified like that:

<external>${project.basedir}/../CHANGELOG.md</external>

@aalmiray
Copy link
Member

aalmiray commented Sep 28, 2022

Aha, then I guess what could happen is that the value of <external> is resolved to a blank string but that would be really hard given the explicit value you've shown. The maven plugin uses the same model classes as core (in v1.2.0) thus testing on CLI should yield the same results as testing with the maven plugin. Something else may be at play here.

@charphi
Copy link
Author

charphi commented Sep 29, 2022

After some digging, I think that the changelog is generated by the ChangelogWorkflowItem whatever the content of JReleaserContext.

@aalmiray aalmiray changed the title Changelog is generated even if an external file is specified [changelog] Changelog is generated even if an external file is specified Oct 2, 2022
@aalmiray
Copy link
Member

I'm unable to reproduce the problem with 1.2.0.

@charphi
Copy link
Author

charphi commented Oct 27, 2022

Strange.
Here is a way to reproduce the problem from a real project:

  1. clone the project https://github.com/nbbrd/picocsv
  2. set the env var JRELEASER_GITHUB_TOKEN to a dummy value such as 123
  3. run the command mvn clean install -DskipTests -Pfull-release -Djreleaser.dry.run
  4. the generated changelog target\jreleaser\release\CHANGELOG.md is different from the expected changelog target\CHANGELOG.md

Note that the GitHub release page has the expected changelog.

@aalmiray aalmiray added this to the v1.3.0 milestone Oct 27, 2022
@aalmiray aalmiray self-assigned this Oct 27, 2022
@aalmiray
Copy link
Member

Found the issue. Thank you for the reproducer! 😅

@aalmiray
Copy link
Member

@aalmiray aalmiray added the released Issue has been released label Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Issue has been released
Projects
None yet
Development

No branches or pull requests

2 participants