Travis Build fixes

* Do only perform a release, if building from tag
* Add missing git config
* Output github releases request in case of error
This commit is contained in:
Andreas Dangel 2017-02-25 20:06:30 +01:00
parent 8eeb0f25c7
commit d8ee6717ee
2 changed files with 15 additions and 8 deletions

View File

@ -4,10 +4,10 @@ set -ev
VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
echo "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
if [[ "$VERSION" == *-SNAPSHOT ]]; then
mvn deploy -Possrh -B -V
else
if [[ "$VERSION" != *-SNAPSHOT && "$TRAVIS_TAG" != "" ]]; then
mvn deploy -Possrh,pmd-release -B -V
else
mvn deploy -Possrh -B -V
fi
bash .travis/build-site.sh
@ -20,9 +20,10 @@ bash .travis/build-site.sh
)
# Uploading pmd distribution to sourceforge
rsync -avh pmd-dist/target/pmd-*-${VERSION}.zip target/pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/
rsync -avh src/site/markdown/overview/changelog.md ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md
if [ "$TRAVIS_TAG" = "" ]; then
rsync -avh pmd-dist/target/pmd-*-${VERSION}.zip target/pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/
rsync -avh src/site/markdown/overview/changelog.md ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md
fi
if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then
# Uploading snapshot site...

View File

@ -26,8 +26,12 @@ cat > release-edit-request.json <<EOF
}
EOF
echo "Updating release at https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}..."
curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data-binary "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}|grep "^HTTP"
RESPONSE=$(curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data-binary "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID})
if [[ "$RESPONSE" != *"HTTP/1.1 200"* ]]; then
echo "$RESPONSE"
else
echo "Update OK"
fi
@ -37,6 +41,8 @@ git clone --depth 1 git@github.com:pmd/pmd.github.io.git
rsync -a target/pmd-doc-${RELEASE_VERSION}/ pmd.github.io/pmd-${RELEASE_VERSION}/
(
cd pmd.github.io
git config user.email "adangel@users.sourceforge.net"
git config user.name "Andreas Dangel (PMD Releases)"
git add pmd-${RELEASE_VERSION}
git commit -m "Added pmd-${RELEASE_VERSION}"
git rm -qr latest