Closed arkadioz closed 7 months ago
Here is how I do it: https://github.com/tomasbjerre/bjurr-bom?tab=readme-ov-file#releasing
Here is how I do it: https://github.com/tomasbjerre/bjurr-bom?tab=readme-ov-file#releasing
Thanks, will check it out and get back to this thread 👍
Hey @tomasbjerre hope you are doing well, I was trying to do the release process with the command you mention, I was trying to run it from git bash, but I ran into some issues maybe you can help me fix or understand better, all of this issues make me think that some configurations I gave at the pom.xml are not being taken in count for some reason (because at intellij when I run mvn generate-resources
or mvn clean install
it works good and takes the configs I gave about inheritance):
1) When running this part of the command:./mvnw se.bjurr.gitchangelog:git-changelog-maven-plugin:semantic-version
it was failing because in my child modules pom.xml
I dont have a <version>
specified, child module looks like this (but from intellij it does not complain about this, that is why I think its a matter of not getting my configuration from the git bash):
<parent>
<artifactId>parent</artifactId>
<groupId>parentgroup</groupId>
<version>0.2.0-SNAPSHOT</version>
</parent>
<artifactId>service</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
notice it only cares for the parent version, I think that this is solved by using <inherited>false</inherited>
in the parents pom.xml but its like it is not reading the configuration I have for the plugin from my pom.xml (I will provide the parents config for semantic-version goal), and when I added the <version></version>
to the child, that step passed successfully.
2) The -SNAPSHOT
word is being added, but I do not know why if in my parent pom.xml the configuration is like the following (when running from intellij runner it takes all this config and does not add the word, but from git bash running the command you gave me it does add it):
<execution>
<id>GenerateSemanticVersion</id>
<phase>generate-resources</phase>
<goals>
<goal>semantic-version</goal>
</goals>
<inherited>false</inherited>
<configuration>
<skip>false</skip>
<!-- Suffix version with -SNAPSHOT //-->
<updatePomWithCurrentSemanticVersionSuffixSnapshot>false
</updatePomWithCurrentSemanticVersionSuffixSnapshot>
<updatePomWithCurrentSemanticVersionSuffixSnapshotIfNotTagged>false
</updatePomWithCurrentSemanticVersionSuffixSnapshotIfNotTagged>
<!-- Regexp patterns used to identify next version can optionally be adjusted //-->
<semanticMajorVersionPattern>^[Bb]reaking</semanticMajorVersionPattern>
<semanticMinorVersionPattern>[Ff]eature</semanticMinorVersionPattern>
<semanticPatchVersionPattern>[Ff]ix</semanticPatchVersionPattern>
</configuration>
</execution>
That is it for now, it might be something obvious but I cannot figure it out right now, will keep trying (also I notice that the ./mvnw release:prepare release:perform
fails if your pom projects version does not contain word -SNAPSHOT
so this is something im trying to see if can be solved too), thank you let me know if you need more inputs from me...
Update: It is definetely not taking my config because it also generates the changelog different to the template I have and it also generates one for the child service which is inherited false, no idea how can I make it get my config :( gonna keep searching
I am seeing that the <inherited>false</inherited>
is honored when you run mvn generate-sources
or mvn clean install
however, if you run mvn se.bjurr.gitchangelog:git-changelog-maven-plugin:git-changelog
then I still see a CHANGELOG file in all the child modules.
Version 1.101.0
@tomasbjerre I could not figure out how to run it like you do it, but I managed to do the same in another way, for concourse pipeline, gonna share it:
jobs:
- name: mvn-release-job
plan:
- task: mvn-release-task
config:
# Tells Concourse which type of worker this task should run on
platform: linux
# This is one way of telling Concourse which container image to use for a task
image_resource:
type: registry-image
source:
repository: my-image # images are pulled from docker hub (default)
username: ((registry-username))
password: ((registry-password))
# The command Concourse will run inside the container
run:
path: /bin/bash
args:
- -c
- |
git config --global user.email "user.email"
git config --global user.name "user.name"
git clone your-repo
cd your-repo
mvn generate-resources
mvn clean install
export NEXT_GIT_TAG=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo Next git tag is: $NEXT_GIT_TAG
git add .
git commit -m "chore: update version to $NEXT_GIT_TAG"
git push
git tag -a $NEXT_GIT_TAG -m "Release $NEXT_GIT_TAG"
git push origin $NEXT_GIT_TAG
mvn generate-resources
git add .
git commit -m "chore: update changelog"
git push
still would be nice to know what I was missing with the command you gave me before, let me know if you have any feedback or questions :)
Hey @tomasbjerre hope you are doing well, could you please provide me with an example of how do you execute today release with your plugin? I have been thinking in how would a CI pipeline workflow be (in my case concourse), for example:
nextRelease.version
or justnextVersion
, so we can run this command:mvn versions:set -DnewVersion=\"${nextRelease.version}\" && mvn clean install
this should set the version in both parent and childs and then just making sure the project keeps building properlly.This is what I imagine it, how are you doing this (the release process)? I see you mention this:
but I dont understand how would it work by itself
Note: this idea comes because I have been also exploring this tool, it is a good tool too, but I prefer the simplicity of your plugin, but I am trying to figure out how to make a pipeline to execute it too and have the dessired result
Also maybe another way that the pipeline could be is the following?
1) Execute plugin to get the semantic-version and also update parent and child poms 2) Push this to the repo and generate the new tag/release, message can be like chore: release newVersion 3) Execute the plugin to update the changelog, now that it finds the new release/tag it will not have the "Unreleased" section with anything 4) Push the changelog update with a message like chore: update changelog