Skip to content

Commit

Permalink
Release 2.6.0. Fix deployment script to actually only deploy releases…
Browse files Browse the repository at this point in the history
… that do not already exist.

The problem was that when '.' was deployed, this means the whole project, no matter what the actually new components are.
  • Loading branch information
khituras committed Dec 18, 2022
1 parent f0ed13f commit d7c28d8
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 294 deletions.
166 changes: 0 additions & 166 deletions jcore-banner-progene-ae/src/main/resources/LICENSE

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<module>jcore-pubmed-db-reader</module>
<module>jcore-pubmed-reader</module>
<module>jcore-lingscope-negation-ae</module>
<module>jcore-banner-progene-ae</module>
<module>jcore-gnormplus-pubmed-db-reader</module>
</modules>
<scm>
Expand Down
65 changes: 65 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
# This script is useful when the whole project should be deployed but some modules have already
# been deployed with the current version, e.g. due to bug fixes. Then, just deploying the base project
# with all its modules would fail due to the already deployed releases.
# If, however, all versions are newly deployed, just use a mvn deploy command on the project root,
# this is much quicker and also results in a single staging repository in Nexus instead of one project
# for each module.
# An alternative is to do the deployment of the root in any case - even with already deployed modules - and
# remove those modules manually in the Nexus UI from the staging repository. One can open the contents of
# a repository and browse it. With a right click on an item one can select to delete it.


echo "Executing deploy"
if [ ! -f julie-xml-tools.jar ]; then
wget https://repo1.maven.org/maven2/de/julielab/julie-xml-tools/0.6.0/julie-xml-tools-0.6.0-xml-tools-assembly.jar --output-document julie-xml-tools.jar
else
echo "julie-xml-tools.jar already exists and is not downloaded."
fi
if [ ! -f julielab-maven-aether-utilities.jar ]; then
wget https://oss.sonatype.org/content/repositories/releases/de/julielab/julielab-maven-aether-utilities/1.1.4/julielab-maven-aether-utilities-1.1.4-cli-assembly.jar --output-document julielab-maven-aether-utilities.jar
else
echo "julielab-maven-aether-utilities.jar already exists and is not downloaded."
fi

modulestodeploy=


echo "Collecting direct child modules of jcore-base and jcore-base itself for deployment"
for i in . `java -jar julie-xml-tools.jar pom.xml //module`; do
java -cp julielab-maven-aether-utilities.jar de.julielab.utilities.aether.apps.GetCoordinatesFromRawPom $i/pom.xml > coords.txt;
if [ ! "$?" -eq "0" ]; then
exit 1
fi
groupId=`grep 'GROUPID:' coords.txt | sed 's/^GROUPID: //'`
artifactId=`grep 'ARTIFACTID:' coords.txt | sed 's/^ARTIFACTID: //'`
version=`grep 'VERSION:' coords.txt | sed 's/^VERSION: //'`
packaging=`grep 'PACKAGING:' coords.txt | sed 's/^PACKAGING: //'`
artifactFile=$i/target/$artifactId-$version.$packaging
# SNAPSHOTS are deployed always anyway
if [[ ! $version =~ .*SNAPSHOT.* ]]; then
echo "Checking if $groupId:$artifactId:$packaging:$version exists"
csNotFound=`java -cp julielab-maven-aether-utilities.jar de.julielab.utilities.aether.apps.GetRemoteChecksums $groupId:$artifactId:$packaging:$version | grep '<checkums not found>'`
fi
if [[ $version =~ .*SNAPSHOT.* ]] || [ "$csNotFound" == "<checkums not found>" ]; then
echo "This is a SNAPSHOT or a release that has not yet been deployed. Deploying."
modulestodeploy=$modulestodeploy,$i
fi
done



if [ ! -z "$modulestodeploy" ]; then
echo "Deploying the following projects: $modulestodeploy"
if [[ "${modulestodeploy}" =~ ".," ]]; then
echo "Deploying parent POM"
mvn clean deploy -P sonatype-nexus-deployment -N
modulestodeploy=$(printf '%s\n' "${modulestodeploy//.,/}")
echo "Modules to deploy after removal of parent POM: $modulestodeploy"
else
echo "Parent POM was not included in the deployment list."
fi
mvn clean deploy -B -P sonatype-nexus-deployment -DskipTests=true -pl $modulestodeploy
else
echo "All modules up to date, skipping deployment."
fi

0 comments on commit d7c28d8

Please sign in to comment.