Skip to content

Commit

Permalink
travis configuration: deploy on build
Browse files Browse the repository at this point in the history
  • Loading branch information
twagoo committed Dec 3, 2020
1 parent a808b98 commit 0ae4248
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .ci/.maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--
This file is included so that Travis can deploy artifacts to CLARIN's nexus repository
<https://nexus.clarin.eu>
More info at <https://trac.clarin.eu/wiki/Nexus>.
-->

<servers>
<server>
<id>CLARIN</id>
<username>${env.NEXUS_DEPLOY_USERNAME}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>CLARIN-Snapshot</id>
<username>${env.NEXUS_DEPLOY_USERNAME}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
</servers>
</settings>
1 change: 1 addition & 0 deletions .ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Files and settings for continuous integration (build/deploy jobs at Travis-CI)
26 changes: 26 additions & 0 deletions .ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Determine Maven goal
# Behaviour can be overridden by exporting the MVN_GOAL variable
if [ ! -z "${MVN_GOAL}" ]
then
echo "Using goal from MVN_GOAL variable: ${MVN_GOAL}"
else
#by default, use "install"
MVN_GOAL="install"

#check if nexus credentials are set
if [ -z "${NEXUS_DEPLOY_USERNAME}" ] || [ -z "${NEXUS_DEPLOY_PASSWORD}" ]
then
echo "Nexus credentials not set. Skipping Maven deployment!"
else
#if snapshot OR tag, deploy
if [ ! -z "${TRAVIS_TAG}" ] || (grep "<version>" pom.xml|head -n1 | egrep -q "<version>.*SNAPSHOT</version>")
then
MVN_GOAL="deploy"
else
echo "Not a snapshot release or tagged revision. Skipping Maven deployment!"
fi
fi
fi
mvn ${MVN_GOAL} $@
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
sudo: false
language: java
jdk:
- openjdk8

script:
- bash -c 'if [ "${TRAVIS_TAG}" ]; then mvn versions:set -DnewVersion=${TRAVIS_TAG} versions:commit; fi'
- .ci/build.sh -B --settings .ci/.maven-settings.xml

deploy:
provider: releases
prerelease: true
api_key: "${GITHUB_DEPLOY_TOKEN}"
file: "target/cmd-toolkit-${TRAVIS_TAG}.jar"
skip_cleanup: true
on:
tags: true

0 comments on commit 0ae4248

Please sign in to comment.