From 18c5a50fdb160c89cea91ed108212c6254321360 Mon Sep 17 00:00:00 2001 From: David Latorre Date: Thu, 16 Jan 2020 17:46:59 +0000 Subject: [PATCH 1/3] Release artifacts from Travis --- .github/workflows/verifybuild.yml | 21 ++++++++++++ .travis.yml | 20 ++++++++++- Makefile | 2 +- pom.xml | 19 +++++++---- travis/deploy.sh | 57 +++++++++++++++++++++++++++++++ travis/mvn-settings.xml | 10 +++++- 6 files changed, 119 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/verifybuild.yml create mode 100644 travis/deploy.sh diff --git a/.github/workflows/verifybuild.yml b/.github/workflows/verifybuild.yml new file mode 100644 index 0000000000..20f4f5360f --- /dev/null +++ b/.github/workflows/verifybuild.yml @@ -0,0 +1,21 @@ +name: Java CI +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn verify -Pquality,linux \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 37803040fa..8472f0d4b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,22 @@ jdk: script: mvn verify -Pquality,linux cache: directories: - - ~/.m2/repository + - "~/.m2/repository" +deploy: +- provider: script + script: travis/deploy.sh + skip_cleanup: true + on: + branch: master +- provider: script + script: travis/deploy.sh + skip_cleanup: true + on: + tags: true +- provider: releases + api_key: $GIT_TOKEN + file_glob: true + file: "./distribution/target/styx-*.zip" + skip_cleanup: true + on: + tags: true \ No newline at end of file diff --git a/Makefile b/Makefile index 93a50d7014..161dec47e4 100644 --- a/Makefile +++ b/Makefile @@ -133,4 +133,4 @@ changelog: # Default configuration file: /styx/default-config/default.yml # docker-image: clean - mvn install -Prelease,linux,docker -Dmaven.test.skip=true + mvn install -Prelease,linux,docker -DskipTests=true -Dmaven.test.skip=true diff --git a/pom.xml b/pom.xml index 6a61573e34..928e1d67b7 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ 2.5.1 2.4 3.5 - 3.0.0-M1 + 3.1.1 2.6 2.4 2.6 @@ -1185,15 +1185,20 @@ sign - - - --pinentry-mode - loopback - - + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + central + https://oss.sonatype.org/ + true + + diff --git a/travis/deploy.sh b/travis/deploy.sh new file mode 100644 index 0000000000..5e2dd5e955 --- /dev/null +++ b/travis/deploy.sh @@ -0,0 +1,57 @@ +#!/bin/bash -xe +# +# Copyright (C) 2013-2020 Expedia Inc. +# +# 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. +# +set -xe +function deployRelease() { + +RELEASE_VARS='GPG_PUBLIC_KEYS GPG_SECRET_KEYS GPG_KEY_NAME GPG_PASSPHRASE DOCKER_USERNAME DOCKER_PASSWORD SONATYPE_JIRA_USERNAME SONATYPE_JIRA_PASSWORD' +for var in ${RELEASE_VARS[@]} +do + if [ -z ${!var} ] ; then + echo "Variable $var is not set. Cannot continue with release. Needed vars: $RELEASE_VARS" + exit 1 + fi +done + +export GPG_DIR="$(pwd)/gpg-temp" +mkdir -p $GPG_DIR +echo $GPG_PUBLIC_KEYS | base64 --decode >> ${GPG_DIR}/pubring.gpg +echo $GPG_SECRET_KEYS | base64 --decode >> ${GPG_DIR}/secring.gpg + +echo "Deploying Release to sonatype and docker hub" +#Ensure a correct version was configured in the pom files. +mvn versions:set -DnewVersion=$TRAVIS_TAG +#Deploy to sonatype +mvn deploy --settings travis/mvn-settings.xml -B -U -P sonatype-oss-release,linux -DskipTests=true -Dmaven.test.skip=true +#Deploy to dockerhub +echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +mvn install -f distribution/pom.xml -B -U -P docker -Dstyxcore.docker.image=dlatorre/styx +docker push dlatorre/styx + +#Prepare macosx bundle for github releases +mvn install -B -U -P macosx,release -DskipTests=true -Dmaven.test.skip=true -Dgpg.skip=true +} + +function deploySnapshot() { + echo "Deploying snapshot to sonatype" + mvn deploy --settings travis/mvn-settings.xml -B -U -P sonatype-oss-release,linux -DskipTests=true -Dmaven.test.skip=true -Dgpg.skip=true +} + +if [[ -n "$TRAVIS_TAG" ]]; then + deployRelease +else + deploySnapshot +fi diff --git a/travis/mvn-settings.xml b/travis/mvn-settings.xml index 968e2a607e..f52e4a166b 100644 --- a/travis/mvn-settings.xml +++ b/travis/mvn-settings.xml @@ -1,4 +1,12 @@ + + + maven-central-mirror + Maven central mirror + https://maven-central.storage-download.googleapis.com/maven2/ + central + + central @@ -15,10 +23,10 @@ sonatype-oss-release - gpg2 false ${env.GPG_DIR}/pubring.gpg ${env.GPG_DIR}/secring.gpg + ${env.GPG_EXECUTABLE} ${env.GPG_KEY_NAME} ${env.GPG_PASSPHRASE} From c1ab6d1f4e3f5470a91c49c1376f947f530e830d Mon Sep 17 00:00:00 2001 From: David Latorre Date: Fri, 24 Jan 2020 08:52:35 +0000 Subject: [PATCH 2/3] Push docker image to hotelsdotcom organization. --- travis/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis/deploy.sh b/travis/deploy.sh index 5e2dd5e955..23c07a8e6e 100644 --- a/travis/deploy.sh +++ b/travis/deploy.sh @@ -38,8 +38,8 @@ mvn versions:set -DnewVersion=$TRAVIS_TAG mvn deploy --settings travis/mvn-settings.xml -B -U -P sonatype-oss-release,linux -DskipTests=true -Dmaven.test.skip=true #Deploy to dockerhub echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -mvn install -f distribution/pom.xml -B -U -P docker -Dstyxcore.docker.image=dlatorre/styx -docker push dlatorre/styx +mvn install -f distribution/pom.xml -B -U -P docker -Dstyxcore.docker.image=hotelsdotcom/styx +docker push hotelsdotcom/styx #Prepare macosx bundle for github releases mvn install -B -U -P macosx,release -DskipTests=true -Dmaven.test.skip=true -Dgpg.skip=true From c9c9a9a23f3ffb1384af5f33b4a33be5a0e33742 Mon Sep 17 00:00:00 2001 From: David Latorre Date: Wed, 29 Jan 2020 15:44:21 +0000 Subject: [PATCH 3/3] Remove github workflow - we can test and re-introduce if needed later. --- .github/workflows/verifybuild.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/verifybuild.yml diff --git a/.github/workflows/verifybuild.yml b/.github/workflows/verifybuild.yml deleted file mode 100644 index 20f4f5360f..0000000000 --- a/.github/workflows/verifybuild.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Java CI -on: [push, pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Set up JDK 8 - uses: actions/setup-java@v1 - with: - java-version: 8 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn verify -Pquality,linux \ No newline at end of file