diff --git a/.travis.yml b/.travis.yml index 5477761ff..1db2ceb9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,19 +3,7 @@ jdk: - oraclejdk8 env: global: - - NODE_VERSION: 6 -before_install: -- nvm install $NODE_VERSION -before-script: -- -script: -- (npm install -g @angular/cli) - && (cd lib && mvn clean install) - && (cd rest && mvn clean install) - && (cd workplace && npm install && ng build --environment=prod) - && (cd admin && npm install && ng build --environment=prod) - && (cd monitor && npm install && ng build --environment=prod) - + - NODE_VERSION: 6 cache: timeout: 604800 #1 week directories: @@ -23,6 +11,10 @@ cache: - "workplace/node_modules" - "admin/node_modules" - "monitor/node_modules" +install: +- mvn clean install -f lib/ -DskipTests=true -Dmaven.javadoc.skip=true -B +script: +- lib/deployment/deploy.sh --dry-run lib/ lib/taskana-core/ lib/taskana-spring/ lib/taskana-cdi/ deploy: provider: cloudfoundry username: tobias.schaefer@novatec-gmbh.de @@ -32,5 +24,4 @@ deploy: organization: '"NovaTec Consulting GmbH"' space: Taskana on: - repo: Taskana/taskana - + repo: Taskana/taskana \ No newline at end of file diff --git a/lib/deployment/codesigning.asc.enc b/lib/deployment/codesigning.asc.enc new file mode 100644 index 000000000..5898a7fd4 Binary files /dev/null and b/lib/deployment/codesigning.asc.enc differ diff --git a/lib/deployment/deploy.sh b/lib/deployment/deploy.sh new file mode 100755 index 000000000..ebe09c2f4 --- /dev/null +++ b/lib/deployment/deploy.sh @@ -0,0 +1,102 @@ +#!/bin/bash +set -e #fail fast + +reqRepo="Taskana/taskana" + +#H Usage: +#H deploy.sh [OPTION] [project dir ...] +#H Where OPTION is one of +#H --help: prints this help messge +#H --dry-run: echos all commands instead of excecution +function helpAndExit { + cat "$0" | grep "^#H" | cut -c4- + exit 0 +} + +# decripting gpg keys and importing them (needed to sign artifacts) +# Global: +# $encrypted_fbbd56f3fa0c_key: decription key +# $encrypted_fbbd56f3fa0c_iv: initialisation vector +# Arguments: +# $1: basedir +function decodeAndImportKeys { + $debug openssl aes-256-cbc -K "$encrypted_fbbd56f3fa0c_key" -iv "$encrypted_fbbd56f3fa0c_iv" -in "$1/codesigning.asc.enc" -out "$1/codesigning.asc" -d + $debug gpg --import "$1/codesigning.asc" +} + + +# deploying a given project +# Arguments: +# $1: project folder (dir) +# $2: profile name +# $3: settings file (dir) +function deploy { + $debug mvn deploy -f "$1" -P "$2" --settings "$3" -DskipTests=true -B -U +} + +function push_new_poms() { + #setup username + git config --global user.email "travis@travis-ci.org" + git config --global user.name "Travis CI" + + #commit all poms + git checkout -b "$branch" + git add "./*pom.xml" + git commit -m "Updated poms to version ${TRAVIS_TAG##v}-SNAPSHOT" + + #push poms (authentication via GH_TOKEN) + git remote add origin-pages "https://$GH_TOKEN@github.com/Taskana/taskana.git" >/dev/null 2>&1 + git push --quiet --set-upstream origin-pages "$branch" +} + +function main { + if [[ "$1" = '--help' || $# -eq 0 ]]; then + helpAndExit + fi + + local debug= + if [[ "$1" = '--dry-run' ]]; then + debug=echo + shift + fi + + if [[ -z "$debug" && ("$TRAVIS" != 'true' || -z "$encrypted_fbbd56f3fa0c_key" || -z "$encrypted_fbbd56f3fa0c_iv") ]]; then + echo "you are not travis or travis does not have the correct encryption key and iv" >&2 + exit 1 + fi + + if [[ "$TRAVIS" == 'true' && "$TRAVIS_REPO_SLUG" != "$reqRepo" ]]; then + echo "Skipping release to sonatype because this repo's name does not match with: $reqRepo" + exit 0 + fi + + decodeAndImportKeys `dirname "$0"` + if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + #check if tagged commit is a head commit of any branch + local commit=`git ls-remote origin | grep "$TRAVIS_TAG" | cut -c1-40` + local branch=`git ls-remote origin | grep -v refs/tags | grep "$commit" | sed "s/$commit.*refs\/heads\///"` + if [[ -z $branch ]]; then + echo "tag $TRAVIS_TAG is not a head commit. Can not release" >&2 + exit 1; + fi + mvn org.codehaus.mojo:versions-maven-plugin:2.5:set -f "$1" -DnewVersion="${TRAVIS_TAG##v}" -DartifactId=* -DgroupId=* + local profile="release" + else + local profile="snapshot" + fi + shift + for dir in "$@"; do + deploy "$PWD/$dir" "$profile" "`dirname "$0"`/mvnsettings.xml" + done + + if [[ -n $branch ]]; then + mvn org.codehaus.mojo:versions-maven-plugin:2.5:set -f "$1" -DnewVersion="${TRAVIS_TAG##v}-SNAPSHOT" -DartifactId=* -DgroupId=* + if [[ -z $GH_TOKEN ]]; then + echo 'GH_TOKEN not set' >&2 + exit 1 + fi + push_new_poms + fi +} + +main "$@" diff --git a/lib/deployment/mvnsettings.xml b/lib/deployment/mvnsettings.xml new file mode 100644 index 000000000..ca553ba4e --- /dev/null +++ b/lib/deployment/mvnsettings.xml @@ -0,0 +1,24 @@ + + + + ossrh + ${env.OSSRH_JIRA_USERNAME} + ${env.OSSRH_JIRA_PASSWORD} + + + + + + ossrh + + true + + + gpg + ${env.GPG_KEY_NAME} + ${env.GPG_PASSPHRASE} + + + + + \ No newline at end of file diff --git a/lib/taskana-cdi/pom.xml b/lib/taskana-cdi/pom.xml index c23f36f21..61d1e2821 100644 --- a/lib/taskana-cdi/pom.xml +++ b/lib/taskana-cdi/pom.xml @@ -5,6 +5,32 @@ taskana-cdi 0.0.1-SNAPSHOT + ${project.groupId}:${project.artifactId} + TODO + http://taskana-workplace.mybluemix.net + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Holger Hagen + holger.hagen@novatec-gmbh.de + NovaTec Consulting GmbH + https://www.novatec-gmbh.de + + + + + scm:git:git://github.com/taskana/taskana.git + scm:git:ssh://github.com:taskana/taskana.git + http://github.com/taskana/taskana/tree/master + + 1.8 1.8 @@ -13,6 +39,85 @@ 3.1.2.Final + + + snapshot + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + @@ -106,6 +211,32 @@ + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + \ No newline at end of file diff --git a/lib/taskana-core/pom.xml b/lib/taskana-core/pom.xml index eab95c129..1bd54995f 100644 --- a/lib/taskana-core/pom.xml +++ b/lib/taskana-core/pom.xml @@ -5,12 +5,117 @@ taskana-core 0.0.1-SNAPSHOT + ${project.groupId}:${project.artifactId} + TODO + http://taskana-workplace.mybluemix.net + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Holger Hagen + holger.hagen@novatec-gmbh.de + NovaTec Consulting GmbH + https://www.novatec-gmbh.de + + + + + scm:git:git://github.com/taskana/taskana.git + scm:git:ssh://github.com:taskana/taskana.git + http://github.com/taskana/taskana/tree/master + + 1.8 1.8 UTF-8 + + + snapshot + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + org.mybatis @@ -96,6 +201,32 @@ + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + +