Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/maven/org.apache.maven.plugins-…
Browse files Browse the repository at this point in the history
…maven-site-plugin-3.20.0
  • Loading branch information
q3769 authored Aug 26, 2024
2 parents 1948379 + 2c75812 commit 89bb5d1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions semver-tag-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Tag and push a new version of the project from the root directory

# Ensure the script is run from the root of the project
[ -f "pom.xml" ] || { echo "Run from the project root with pom.xml"; exit 1; }

# Ensure the working directory is clean
[ -z "$(git status --porcelain)" ] || { echo "Working directory is not clean, please commit or stash your changes"; exit 1; }

# Ensure current POM version is a valid semver
mvn semver:verify-current >/dev/null || { echo "Current POM version is not a valid semver version"; exit 1; }

# Get the current version from the pom.xml file
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr -d "[:space:]")

# Create and push a new tag with the current version
git tag -a "$CURRENT_VERSION" -m "Release version tag $CURRENT_VERSION"
git push origin "$CURRENT_VERSION"

echo "Tagged and pushed version $CURRENT_VERSION."

0 comments on commit 89bb5d1

Please sign in to comment.