Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Allow Travis to stage release build #155

Merged
merged 6 commits into from
Jan 15, 2016
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
language: java
script:
- ant -f ./client-libraries/java/rest-client/build.xml -lib ./client-libraries/java/rest-client/lib
deploy
- ./build.sh
before_install:
- cp settings.xml ${HOME}/.m2/settings.xml
after_success:
- echo "deploy completed."
branches:
only:
- master
env:
global:
- secure: JLi7Nhp/kr5Nv8e3Ldg0jEyitvjSljZwNLlR5SHphvUlV7POvVNqXJ994358wySD9sDEFCupHdO5sCmIkw4f9rQfEOB7uCWVr3qBR7qalQAeSCSjxkPAZMB7oZZrlgBR+aviwiUHlElVB+Qn6QtUWZfwT5qmCzKDTFTPiDaby2s=
- secure: MN7EKwGBOUQ9FDA4TXnq4lDprIBXmkXHMsp6jSBhdyXaZt0ix/FcmCqCYNumxrAVxquHRmcgb6hI5EuqZNHfI0hTvhbPGG9MIKweMNzWC3O9Lw44ufvog2wa2Xa/+hJDHNSLsL5HiF4sWy//V7/GcfYnIpdl/GN43dKBsd8FooQ=
- secure: Me3raHMfhxGb9nYnxBSBW+vAzsw1Aq+pAajwmbqXonr6L9Qq4hRAd07g7NavPw3sGGeLpTe9s0TzKnEAi01DmTLcAu+CWTaBjSxUlNXZHGdUBl3czOpjcm4iqw86HPAlxb+ZkqBRmHe24w/kJY6oqIOo+9Zj4lw09QAUYflLqvI=
- secure: bvJg8pV4qPqbuh+BX3QxyZcCZmdJGD5VQnzMRz/9F1enonfuwJfbPqerScDONgOYl8V0P+Q1NN8HOa/SkjHp7IeVqJmWHFhfM1r3uahck/6fGO+FsfWqjBfjpRx7QDNPq3hKXVLoRBmNBlnQxoMpzOogiszWXOG22BLr511DdZM=
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: add some comments to explain the flow so that it's clear for everyone, then looks ready :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

tagLen=${#TRAVIS_TAG}
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
if [ $tagLen -gt 0 ]; then
echo "tagged so deploy"
openssl aes-256-cbc -K $encrypted_8864fe5d711d_key -iv $encrypted_8864fe5d711d_iv -in sign.key.enc -out sign.key -d
gpg --import sign.key
ant -f ./client-libraries/java/rest-client/build.xml -lib ./client-libraries/java/rest-client/lib deploy
else
echo "not tagged so stage"
ant -f ./client-libraries/java/rest-client/build.xml -lib ./client-libraries/java/rest-client/lib stage
fi
else
echo "PR so test"
ant -f ./client-libraries/java/rest-client/build.xml -lib ./client-libraries/java/rest-client/lib tests
fi
57 changes: 53 additions & 4 deletions client-libraries/java/rest-client/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
-->
<project name="gcm-server" default="dist" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

<property name="version" value="dev"/>
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="lib" location="lib"/>
Expand All @@ -30,14 +29,16 @@
<!-- define Maven coordinates -->
<property name="groupId" value="com.google.gcm" />
<property name="artifactId" value="gcm-server" />
<property name="version" value="1.0-SNAPSHOT" />
<property name="version" value="1.0.0" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="jar" value="${dist}/${artifactId}-${version}.jar" />
<property name="javadoc-jar" value="${dist}/${artifactId}-${version}-javadoc.jar"/>
<property name="sources-jar" value="${dist}/${artifactId}-${version}-sources.jar"/>
<!-- defined maven snapshots and staging repository id and url -->
<property name="ossrh-snapshots-repository-url"
value="https://oss.sonatype.org/content/repositories/snapshots" />
<property name="ossrh-staging-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- there server id in the Maven settings.xml -->
<property name="ossrh-server-id" value="ossrh" />

Expand Down Expand Up @@ -114,6 +115,20 @@
</antcall>
</target>

<target name="doc" depends="compile, tests" description="generate documentation">
<javadoc sourcepath="${src}" destdir="${dist}/javadoc">
<classpath>
<fileset dir="${lib}">
<include name="json_simple-1.1.jar"/>
</fileset>
</classpath>
</javadoc>
</target>

<target name="javadoc-jar" depends="doc" description="generate doc jar">
<jar destfile="${javadoc-jar}" basedir="${dist}/javadoc"/>
</target>

<target name="_jar">
<jar destfile="${_destfile}" basedir="${_basedir}">
<manifest>
Expand All @@ -125,14 +140,14 @@
</jar>
</target>

<target name="dist" depends="jar, src-jar" description="Generate all artifacts."/>
<target name="dist" depends="jar, src-jar, javadoc-jar" description="Generate all artifacts."/>

<target name="update-demo" depends="jar" description="Generates a new GCM server library JAR and copy it to the demo project.">
<copy file="${jar}" todir="${demo-dir}/WebContent/WEB-INF/lib"/>
<copy file="${jar}" todir="${demo-appengine-dir}/WebContent/WEB-INF/lib"/>
</target>

<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
<target name="stage" depends="dist" description="deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${ossrh-snapshots-repository-url}" />
Expand All @@ -142,4 +157,38 @@
<arg value="-e" />
</artifact:mvn>
</target>

<!-- before this, update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE -->
<target name="deploy" depends="dist" description="deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=client-libraries/java/rest-client/pom.xml" />
<arg value="-Dfile=${jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=client-libraries/java/rest-client/pom.xml" />
<arg value="-Dfile=${sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=client-libraries/java/rest-client/pom.xml" />
<arg value="-Dfile=${javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>

</project>
2 changes: 1 addition & 1 deletion client-libraries/java/rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gcm</groupId>
<artifactId>gcm-server</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>GCM Java Server Client Library</name>
<description>Manage GCM on server</description>
Expand Down
13 changes: 13 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,17 @@
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<!-- Optionally specify a different path and name for the gpg executable
if it differs from the default of "gpg"
<gpg.executable>gpg2</gpg.executable>
-->
<gpg.keyname>${env.GPG_KEY_ID}</gpg.keyname>
<gpg.passphrase>${env.GPG_KEY_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
Binary file added sign.key.enc
Binary file not shown.