Skip to content

Commit

Permalink
Fix the "Deploy Snapshots" action to only run for snapshot versions
Browse files Browse the repository at this point in the history
  • Loading branch information
thegridman committed Apr 26, 2023
1 parent 20d1dd9 commit 7d052d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
git checkout "${GIT_COMMIT}"
git config --local user.name "${GIT_USER}"
git config --local user.email "${GIT_EMAIL}"
mvn -s ./.mvn/settings.xml -B clean deploy -DskipTests -Pcoherence-ce -Dgithub.build=true
sh etc/deploy-snapshots.sh
17 changes: 17 additions & 0 deletions etc/deploy-snapshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -e

CURRENT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -nsu | grep -e '^[[:digit:]]')

if [ "${CURRENT_VERSION}" = "" ]; then
echo "Could not find current version from Maven"
exit 1
fi

if [ -z $(echo "${CURRENT_VERSION}" | grep SNAPSHOT) ]; then
echo "This job only deploys SNAPSHOT versions, skipping version ${CURRENT_VERSION}"
exit 0
fi

echo "Building version ${CURRENT_VERSION}"
mvn -s ./.mvn/settings.xml -B clean deploy -DskipTests -Pcoherence-ce -Dgithub.build=true

0 comments on commit 7d052d0

Please sign in to comment.