Skip to content

jenspapenhagen/maven-get-version-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maven-get-version-action

This GitHub Action retrieves the pom version from the pom.xml file and sets the full version in the version output value usable in your workflow file which can be used in a following step by using ${{ steps.pom-version.outputs.version }}.

Part of the pom.xml file:

<version>1.2.3-SNAPSHOT</version>

We can extract all Parts of the Version Number, with remove of "-SNAPSHOT" postfix.

More Examples

This GitHub Action support the semver schema

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes
MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

More Information on Semantic Versioning: Website

Example

To use this action in your project, use the following:

- name: get-pom-version
  id: pom-version
  uses: jenspapenhagen/maven-get-version-action@v1.0.9

- name: Print Maven POM project version
  run: echo "version = ${{ steps.pom-version.outputs.version }}"
  
- name: Print Maven POM major version
  run: echo "major = ${{ steps.pom-version.outputs.major }}"
  
- name: Print Maven POM minor version
  run: echo "minor = ${{ steps.pom-version.outputs.minor }}"
    
- name: Print Maven POM patch version
  run: echo "patch = ${{ steps.pom-version.outputs.patch }}"

Params

- name: get-pom-version
  id: pom-version
  uses: jenspapenhagen/maven-get-version-action@v1.0.9
  with:
    path: "mavenproject/<yourproject>"  # Optional: pom.xml relative folder path (exclude "/pom.xml" in the path)
    args: "-s ~/.m2/settings.xml"       # Optional: maven additional args to run 

About

GitHub Action to get the Maven version of a pom.xml file using mvn evaluate

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%