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

Commit

Permalink
Switching to new deploy script with a more sensible versioning scheme
Browse files Browse the repository at this point in the history
for release candidates
  • Loading branch information
llorllale committed May 31, 2018
1 parent b315611 commit c9bfa7e
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 32 deletions.
44 changes: 12 additions & 32 deletions .travis.yml
Expand Up @@ -15,19 +15,17 @@ jdk:
jobs:
include:
- if: type = pull_request
script:
- mvn -P release-profile -DskipTests=true clean install
- mvn -P integration-tests clean cobertura:cobertura-integration-test && mvn -DskipTests=true cobertura:check-integration-test
- bash <(curl -s https://codecov.io/bash)
- if: type = push AND tag IS present
script:
- openssl aes-256-cbc -K $encrypted_af28e35ab9a0_key -iv $encrypted_af28e35ab9a0_iv
-in release/codesigning.asc.enc -out release/codesigning.asc -d
- gpg --fast-import release/codesigning.asc
- mvn --settings release/mvnsettings.xml -P deploy -DskipTests=true clean deploy
- mvn loggit:changelog -Dloggit.startTag=$(git tag --list | tail -2 | head -1)
- mvn releasecat:upload -Dreleasecat.token=$site_token -Dreleasecat.tag=$TRAVIS_TAG -Dreleasecat.name=$TRAVIS_TAG
- mvn -P site clean compile site
script: mvn -P release-profile -DskipTests=true clean install &&
mvn -P integration-tests clean cobertura:cobertura-integration-test &&
mvn -DskipTests=true cobertura:check-integration-test &&
bash <(curl -s https://codecov.io/bash)
- if: type = push AND branch = master
script: mvn -P release-profile clean install &&
mvn -P integration-tests clean cobertura:cobertura-integration-test &&
mvn -DskipTests=true cobertura:check-integration-test &&
bash <(curl -s https://codecov.io/bash) &&
cd release && ./deploy.sh && cd .. &&
mvn -P site clean compile site
deploy:
provider: pages
skip_cleanup: true
Expand All @@ -36,25 +34,7 @@ jobs:
on:
tags: true
branch: master
- if: type = push AND NOT tag IS present AND branch = master
script:
- mvn -P integration-tests clean cobertura:cobertura-integration-test && mvn -DskipTests=true cobertura:check-integration-test
- bash <(curl -s https://codecov.io/bash)
- mvn -P release-profile -DskipTests=true clean install
- openssl aes-256-cbc -K $encrypted_af28e35ab9a0_key -iv $encrypted_af28e35ab9a0_iv
-in release/codesigning.asc.enc -out release/codesigning.asc -d
- gpg --fast-import release/codesigning.asc
- export VERSION=$(mvn help:evaluate -Dexpression=project.version | grep '^[0-9]' | sed "s/SNAPSHOT/rc$TRAVIS_BUILD_ID/")
- echo "Candidate Version is $VERSION"
- mvn versions:set -DnewVersion=$VERSION && mvn --settings release/mvnsettings.xml -P deploy -DskipTests=true clean deploy
- mvn -P site clean compile site
deploy:
provider: pages
skip_cleanup: true
local_dir: target/site/
github_token: "$site_token"
on:
branch: master

env:
global:
- secure: Ly/cSCAsrpP7wqbJU67zG/rqcJIIE/KqAVlGK84+zHi/jY9x9FeXecccmnLuPzWL60rlEYI93drnTHf1lVOiz4P6Hvhkfg4zarGljtzKUeE7BnZlreHtbGUWV8IgDlaK/ovoFC4/wsU/Od2WZGA19hJN6iFxV/3cJljxC0AlUQ7GGjpbZUX/4k29CKTWO4NF4EmQJqViWBeSuLeo+F8hTq/pcmtkSFFbzRqu4GAmcC4MxKojhZ8QHY5VeLRTPtvwAdDm8mTifS8cguGk6JoHEsHGiJhcJe8gkDwFix+vaC/9WZ5KgBDs9PP46lBM5RdnP7b4iOsPRfnigz5W/70p6lbe5gJcgByIO/sVfcSDK1UHITzpg2GCvSoc8QUV2f6l8z4mYBaiq0JkSAWxu84ukZLPVKqbZ0+RbgvVGFeYpRt9Xw/OAv13ZMdAa3a3h+4pYeaviNIbu9y0O9wnGo5dc0qK7HwuaxVY8XdTW+Vu81OGbeGWMu1MBzSzTKYuHNJfY62KD+f1x4Snrtqa2D9LeQEt2nqffynOuB7Eka/+nI9mYZ3wz6FTJ7HRZJa4Na4W9RfO1jndxlJdfJqXyUgppb5wFC+WXgwjAmN0sBdCw+O0Gv95UXPX3XaxQlI0YTHkwlxKanxjRJ/uyqxl9OJFz+kB9TysyYOk4fa5pRfLq1U=
Expand Down
71 changes: 71 additions & 0 deletions release/deploy.sh
@@ -0,0 +1,71 @@
#
# Copyright 2017 George Aristy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


# Deploys binaries for full and candidate releases

POM=../pom.xml
MVN="mvn -f $POM"

# Version currently set in the POM
project_version()
{
echo $($MVN help:evaluate -Dexpression=project.version | grep "^[0-9]")
}

# A candidate version calculated based on the current POM version and the number
# of commits since the last git tag
release_candidate_version()
{
DESCRIBE=$(git describe)

if [ -z "$DESCRIBE" ]; then
RC_VERSION=$(git rev-list --count HEAD)
else
RC_VERSION=$(echo $DESCRIBE | cut -d - -f 2)
fi

actual=$(project_version)
echo $(echo $actual | sed "s/SNAPSHOT/rc$RC_VERSION/")
}

# If the current POM version is a SNAPSHOT
is_snapshot()
{
actual=$(project_version)
[[ $actual =~ ^.*SNAPSHOT$ ]] && echo 1 || echo 0
}

project_version=$(project_version)
is_snapshot=$(is_snapshot)

if [ $is_snapshot ]; then
release_version=$(release_candidate_version)
$MVN versions:set -DnewVersion=$release_version > /dev/null
else
release_version=$project_version
$MVN loggit:changelog -Dloggit.startTag=$(git tag --list | tail -2 | head -1)
$MVN releasecat:upload -Dreleasecat.token=$site_token -Dreleasecat.tag=$TRAVIS_TAG -Dreleasecat.name=$TRAVIS_TAG
fi

echo project version: $project_version
echo is snapshot: $is_snapshot
echo release version: $release_version

openssl aes-256-cbc -K $encrypted_af28e35ab9a0_key -iv $encrypted_af28e35ab9a0_iv -in codesigning.asc.enc -out codesigning.asc -d
gpg --fast-import codesigning.asc
$MVN --settings mvnsettings.xml -P deploy -DskipTests=true clean deploy

0 comments on commit c9bfa7e

Please sign in to comment.