Issue
I'm new in this devops world. I'm building a Java SprinBoot API with maven. I'm building my yml file to develop the worfklow so when I push a change in my main branch then the workflow can execute and deploy a new release version in my Artifactory repository.
I want to deploy a new Release version in artifactory, but also change my local pom.xml project version to a SNAPSHOT at the sime time. Here is the part of my workflow where I create the Snapshot version and then the deploy, I know is not complete, but I don't know how to do the 2 steps.
- name: Increment Version
run: |
chmod +x mvnw
./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT versions:commit
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add .
git commit -m "updated version in pom.xml"
git push
- name: Create Git Tag
run: |
export version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
git config user.name "GitHub Action"
git config user.email "[email protected]"
git tag -a $version -m "$version"
git push origin $version
- name: Deploy release to artifactory
run: |
echo ${{ secrets.SETTINGS_XML }} ~/.m2/settings.xml
mvn deploy
Thank you so much guys!
Solution
I want to deploy a new Release version in artifactory, but also change my local pom.xml project version to a SNAPSHOT at the sime time
that is exactly what maven-release-plugin
actually performs. You have two options:
- use Java Maven release github action
- learn how
maven-release-plugin
is doing that (prepare, perform) and try to reproduce that
Answered By - Andrey B. Panfilov
Answer Checked By - Pedro (JavaFixing Volunteer)