diff --git a/.travis.yml b/.travis.yml index 305c6af73b..b76728a379 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,11 +49,27 @@ jobs: # upload coverage report - bash <(curl -s https://codecov.io/bash) - - name: "Documentation Deployment" + - name: "Create and Release Artifacts" jdk: oraclejdk8 - install: ./gradlew :inspectit-oce-documentation:asciidoctor + sudo: true + rvm: + - 2.4 + before_install: + - if [ -z "${TRAVIS_TAG}" ]; then RELEASE_VERSION="SNAPSHOT-${TRAVIS_BUILD_NUMBER}"; else RELEASE_VERSION="${TRAVIS_TAG}";fi + - echo "Setting version to $RELEASE_VERSION" + install: ./gradlew -PbuildVersion=$RELEASE_VERSION assemble packageDocumentation script: skip + before_deploy: + - mkdir -p ~/bin && curl -sSL -o ~/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && chmod +x ~/bin/jq + - export PATH=$PATH:~/bin + - jq --version + - gem install bundler + - gem install rspec + - gem install github_changelog_generator + - chmod +x ./resources/github-release-script.sh + - if [ -z "${TRAVIS_TAG}" ]; then echo "Not release build."; else ./resources/github-release-script.sh;fi deploy: + ############################# # MASTER BUILDS - provider: s3 access_key_id: $AWS_ACCESS_KEY_ID @@ -66,7 +82,9 @@ jobs: on: tags: false branch: master + ############################# # RELEASE BUILDS + # > Documentation - provider: s3 access_key_id: $AWS_ACCESS_KEY_ID secret_access_key: $AWS_SECRET_ACCESS_KEY @@ -89,6 +107,17 @@ jobs: on: tags: true branch: master + # > Github Release + - provider: releases + api_key: "${GITHUB_TOKEN}" + name: "Version $RELEASE_VERSION" + file: + - "inspectit-oce-agent/build/inspectit-oce-agent-$RELEASE_VERSION.jar" + - "inspectit-oce-documentation/build/distributions/inspectit-oce-documentation-$RELEASE_VERSION.zip" + skip_cleanup: true + on: + tags: true + branch: master stages: diff --git a/build.gradle b/build.gradle index 17566cb163..8876d21ab2 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,12 @@ allprojects { } } apply plugin: 'jacoco' + + if (!project.hasProperty('buildVersion') || project.getProperty('buildVersion').empty) { + ext.buildVersion = 'SNAPSHOT' + } + + version = "$buildVersion" } subprojects { @@ -25,7 +31,7 @@ subprojects { dependencies { buildTools( - 'jarcheck:jarcheck:1.5' + 'jarcheck:jarcheck:1.5' ) compileOnly 'org.projectlombok:lombok:1.18.4' annotationProcessor 'org.projectlombok:lombok:1.18.4' @@ -67,7 +73,7 @@ subprojects { task codeCoverageReport(type: JacocoReport) { group = 'Verification' - description ='Generates a combined report from all subprojects' + description = 'Generates a combined report from all subprojects' executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec") diff --git a/gradle.properties b/gradle.properties index 0b1ec85b19..f527bd6ba8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,2 @@ -releaseVersion=0.1.M1 openCensusVersion=0.18.0 prometheusClientVersion=0.6.0 \ No newline at end of file diff --git a/inspectit-oce-agent/build.gradle b/inspectit-oce-agent/build.gradle index 5336d4fb37..3af539d976 100644 --- a/inspectit-oce-agent/build.gradle +++ b/inspectit-oce-agent/build.gradle @@ -1,5 +1,3 @@ -version = "${releaseVersion}" - dependencies { compileOnly( project(':inspectit-oce-bootstrap'), diff --git a/inspectit-oce-bootstrap/build.gradle b/inspectit-oce-bootstrap/build.gradle index b449afebda..29d9727e8c 100644 --- a/inspectit-oce-bootstrap/build.gradle +++ b/inspectit-oce-bootstrap/build.gradle @@ -3,7 +3,7 @@ dependencies { } jar { - archivesBaseName = "${project.name}" + archiveName = "${project.name}.jar" //include all "implementation" dependencies in fat jar from { diff --git a/inspectit-oce-core/build.gradle b/inspectit-oce-core/build.gradle index 24026ee697..54b609cdde 100644 --- a/inspectit-oce-core/build.gradle +++ b/inspectit-oce-core/build.gradle @@ -80,7 +80,7 @@ task buildOpencensusFatJar(type: Jar) { } jar { - archivesBaseName = "${project.name}" + archiveName = "${project.name}.jar" //include the open-census dependencies as a fat jar dependsOn buildOpencensusFatJar diff --git a/inspectit-oce-documentation/build.gradle b/inspectit-oce-documentation/build.gradle index d5afc1f1dc..e7a5e2f552 100644 --- a/inspectit-oce-documentation/build.gradle +++ b/inspectit-oce-documentation/build.gradle @@ -10,8 +10,6 @@ buildscript { apply plugin: 'org.asciidoctor.convert' -version = "${releaseVersion}" - asciidoctor { // TODO fail the task on asciidoctor warnings when updating to v2.+ attributes 'inspectit-oce-version': project.version, diff --git a/resources/github-release-script.sh b/resources/github-release-script.sh new file mode 100644 index 0000000000..90c6d0e32a --- /dev/null +++ b/resources/github-release-script.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Based on the shell script of Github user Jaskaranbir (https://gist.github.com/Jaskaranbir/d5b065173b3a6f164e47a542472168c1) + +# ===> Set these variables first +branch="master" +repo_slug="$TRAVIS_REPO_SLUG" +token="$GITHUB_TOKEN" +version="$TRAVIS_TAG" + +LAST_REVISION=$(git rev-list --tags --skip=1 --max-count=1) +LAST_RELEASE_TAG=$(git describe --abbrev=0 --tags ${LAST_REVISION}) + +# Generate CHANGELOG.md +github_changelog_generator \ + -u $(cut -d "/" -f1 <<< $repo_slug) \ + -p $(cut -d "/" -f2 <<< $repo_slug) \ + --token $token \ + --since-tag ${LAST_RELEASE_TAG} \ + --no-author \ + --no-unreleased \ + --header-label "## Changelog" + +sed -i -e '3,5d' CHANGELOG.md +sed -i '$ d' CHANGELOG.md + +echo "You can also find the corresponding documentation online under the following link: [Documentation $version](http://docs.inspectit.rocks/releases/$version)" > release_body.md +echo "" >> release_body.md +cat CHANGELOG.md >> release_body.md + +body="$(cat release_body.md)" + +# Overwrite CHANGELOG.md with JSON data for GitHub API +jq -n \ + --arg body "$body" \ + --arg name "Version $version" \ + --arg tag_name "$version" \ + --arg target_commitish "$branch" \ + '{ + body: $body, + name: $name, + tag_name: $tag_name, + target_commitish: $target_commitish, + draft: false, + prerelease: false + }' > CHANGELOG.md + +echo "Create release $version for repo: $repo_slug, branch: $branch" +curl -H "Authorization: token $token" --data @CHANGELOG.md "https://api.github.com/repos/$repo_slug/releases" \ No newline at end of file