Skip to content

Commit

Permalink
extended the script to support building release from git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
BGehrels committed Sep 27, 2015
1 parent 39fe2a3 commit a1aae1b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
26 changes: 18 additions & 8 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@
# Get the original sources from Douglas Crockfords GitHub repo
git clone https://github.com/douglascrockford/JSON-java.git original

echo ""
echo "The following tags exist in the repository:"
cd original
git tag -l

echo "Please enter the tag name to be released"
read tagName

git checkout tags/${tagName}
cd ..

# repackage them into maven standard layout
mkdir -p dist/src/main/java/org/json
rm original/README
mv original/* dist/src/main/java/org/json/
rm dist/src/main/java/org/json/README
rm -Rf original

# Add a pom.xml with the current date as version
cp pom.xml dist/
sed -i "s/%%VERSION%%/`date +%Y%m%d`/g" dist/pom.xml
sed -i "s/%%VERSION%%/${tagName}/g" dist/pom.xml

# Build and release it
cd dist
mvn deploy -Psonatype-oss-release
cd ..
ech ""
echo "Please run mvn deploy in the dist folder"
echo "use a shell with a working gpg2 command. Hit <enter> afterwards."
read succes

# and clean everything up again
rm -Rf original
rm -Rf dist
26 changes: 25 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>

</project>

0 comments on commit a1aae1b

Please sign in to comment.