File tree Expand file tree Collapse file tree 1 file changed +24
-7
lines changed Expand file tree Collapse file tree 1 file changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -319,14 +319,31 @@ jobs:
319319 git config user.name "GitHub Actions"
320320
321321 VERSION="${{ needs.build.outputs.version }}"
322- mvn -B versions:set "-DnewVersion=$VERSION" versions:commit "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
323-
324- git commit -am "[skip ci] set release version $VERSION"
325- git push origin HEAD:$MAIN_BRANCH
326-
322+
323+ # Check if the version has already been set in the POM file
324+ CURRENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
325+ if [ "$CURRENT_VERSION" = "$VERSION" ]; then
326+ echo "Version $VERSION is already set in the POM file."
327+ else
328+ mvn -B versions:set "-DnewVersion=$VERSION" versions:commit "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
329+ fi
330+
331+ # Check if there are changes to commit
332+ if git diff --quiet; then
333+ echo "No changes to commit."
334+ else
335+ git commit -am "[skip ci] set release version $VERSION"
336+ git push origin HEAD:$MAIN_BRANCH
337+ fi
338+
339+ # Check if the tag already exists
327340 TAG_NAME="v$VERSION"
328- git tag -f $TAG_NAME
329- git push origin -f --tags
341+ if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
342+ echo "Tag $TAG_NAME already exists."
343+ else
344+ git tag -f $TAG_NAME
345+ git push origin -f --tags
346+ fi
330347
331348 - name : gpg version
332349 id : show-gpg-version
You can’t perform that action at this time.
0 commit comments