camunda-community-hub / community-action-maven-release

Opinionated GitHub action to release community projects to Maven Central
Apache License 2.0
7 stars 4 forks source link

Additional options for each mvn execution #9

Closed gclaussn closed 3 years ago

gclaussn commented 3 years ago

To be able to use the release action with a Maven project, which is not in the root directory, an additional input is required (e.g. -f path/to/pom.xml). Currently there is an input called "maven-release-options", but this input is not used in/not appropriate for line 58: https://github.com/camunda-community-hub/community-action-maven-release/blob/main/action.yml#L58

Suggestion: Add following input

  maven-additional-options:
    description: Any extra Maven options
    required: false
    default: ""

and add the new input to all Maven executions:

mvn -B ${{ inputs.maven-additional-options }} ...

Moreover the option must be passed to resources/prepare-next-development-version.sh: https://github.com/camunda-community-hub/community-action-maven-release/blob/main/resources/prepare-next-development-version.sh#L24

Background: In bpmn-driven-testing the Maven project, which should be released, is located in the "maven-plugin" directory. Therefore the Maven option "-f maven-plugin/pom.xm" must be added. Otherwise the action fails with:

The goal you specified requires a project to execute but there is no POM in this directory (/home/runner/work/bpmn-driven-testing/bpmn-driven-testing). Please verify you invoked Maven from the correct directory.

I tried to use the "maven-release-options" input: https://github.com/camunda-community-hub/bpmn-driven-testing/blob/master/.github/workflows/deploy.yml#L36

But it does not work, since the "maven-release-options" are understandably not used in line 58 of the action.

celanthe commented 3 years ago

Hi @gclaussn! Thank you so much for opening this issue! I'll take a look and will get back to you ASAP! :)

celanthe commented 3 years ago

Thank you for the clear suggestion. @gclaussn I've made an effort to incorporate your changes in pull requests #10 and #11!

gclaussn commented 3 years ago

Hi Rin,

I added a comment to each pull request, please have a look. I don't think the inlining will work, the new input just needs to be added under inputs (where the other inputs are already defined). The Maven executions must invoke the same goals as before (my "..." were just a placeholder), because the release action should work like before. Only the additional options should be included.

If you want, I can do the change and create a pull request!?

celanthe commented 3 years ago

Thank you so much for your thoughtful and helpful comments @gclaussn! I made two more PRs this morning, #12 and and update to #11. I hope these get this issue a bit closer to the finish line!

gclaussn commented 3 years ago

Hi Rin,

thank you for your efforts, I think there is still something missing in the action and in the prepare-next-development-version.sh you removed the mvn update versions.

I created a pull request with all desired changes: https://github.com/camunda-community-hub/community-action-maven-release/pull/13/files

I hope this ok for you - don't wanted to create trouble or confusion!

celanthe commented 3 years ago

Hi @gclaussn! Thank you so much, this looks great. :) We'll take a look and hopefully get #13 merged in soon!

celanthe commented 3 years ago

Hi @gclaussn! I just merged #13, which I hope should better enable you to make use of the automated release process in the Community Hub! I will update the README accordingly to detail the changes made here!

gclaussn commented 3 years ago

Hi @celanthe, the additional Maven options seem to work :-)

But there is another problem, which I have not seen before: https://github.com/camunda-community-hub/community-action-maven-release/blob/main/action.yml#L68

The SNAPSHOT release fails with:

sed: can't read target/nexus-staging/deferred/.index: No such file or directory

I tested locally how to fix this statement using "find", so that it works in both cases (target directory under root and target directory anywhere else):

$ find . -path '**target/nexus-staging/deferred/.index'
./target/nexus-staging/deferred/.index
maven-plugin/target/nexus-staging/deferred/.index

Please see pull request https://github.com/camunda-community-hub/community-action-maven-release/pull/14!

gclaussn commented 3 years ago

@celanthe, now the SNAPSHOT build/release is working when merging into master. I will try perform a release, following the release process documentation, in the next days.

But this issue is resolved and will be closed.

Thank you for your support!