Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .travis.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@
<servers>
<server>
<id>jcenter</id>
<username>sigiesec</username>
<username>sigiesec</username>
<password>${env.JCENTER_TOKEN}</password>
</server>
<server>
<id>jcenter-release</id>
<username>sigiesec</username>
<password>${env.JCENTER_TOKEN}</password>
</server>
<server>
<id>github.com</id>
<username>sigiesec</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
23 changes: 16 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ after_success:

# based on https://blog.travis-ci.com/2017-03-30-deploy-maven-travis-ci-packagecloud/
deploy:
provider: script
script: "cp .travis.settings.xml $HOME/.m2/settings.xml && chmod +x deploy.sh && ./deploy.sh"
skip_cleanup: true
on:
repo: btc-ag/service-idl
all_branches: true
# tags: true
- provider: script
script: "./deploy.sh"
skip_cleanup: true
on:
repo: btc-ag/service-idl
all_branches: true
- provider: releases
api_key:
secure: sBBKOHsfxDuoMzjoqGAh3Ps6BUL0/3YuWYQKofYexzNYGffCiDWNaW2tX49MwIVzNZEbIHgi1m1e7gcqJ66RhfypyATaAA4N8jaT9QYI8l/SH73ZEuCnknf1J4vNyJi3Ml5cUWvFrrIJBBok7WX7HFofGXiOozJ9PcGJ8EknRxeMQXpOSXFztOIRUraDm30oh7nBEvTGjW0Pl0sG3d771Ez9C163hbcatvsihfJt+/7K0pwz77fM4nLRnLQcktrSou1phbeg064zRU4PAPm7iozxHfSKLX+/Ci6+IHiFiSbBVYi4MauP1Xw2nvcXWKUbahTGS3DCjKRTrL53OFOy0Qc1Hk0nGBuZqtPJ/EvV7f4FJJ1Y9Lu769YcFoB20ZnNnwsvtiSkdZO5w5Jwi9VWmInV6QOqc0RuhH7La+f4gD0SoB845tEADYLqYurITif5lnJEE+Q+MgbdcbmyVQU+4smj03gRcL9KIm8WMWuwCODr5IhsvA6EYO9ElGgpNjhTkOTBpaR/LWIz570syYHCEyHw8eqo/78roHy6+5MHoFZZwA0Ok+0Jw8HN6i78s5vQKJQXWEDNqyl/znuQ1dd1D+gh3C5BscsmHNz8iFoxrt2iFYkupRIL6Lnuu+d5ve8T9tDUCA2wZHqPlDagI/H/NvrUDgu8p1Zb4QH5UDo/3eE=
file_glob: true
file:
- "${TRAVIS_BUILD_DIR}/com.btc.serviceidl.plainjava/target/com.btc.serviceidl.plainjava-*.jar"
skip_cleanup: true
on:
repo: btc-ag/service-idl
tags: true
2 changes: 1 addition & 1 deletion com.btc.serviceidl.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature id="com.btc.serviceidl.feature"
label="Idl Feature "
version="1.0.0.qualifier">
version="0.1.0.qualifier">
<plugin
id="com.btc.serviceidl"
download-size="0"
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.btc.serviceidl.ide
Bundle-ManifestVersion: 2
Bundle-Name: com.btc.serviceidl.ide
Bundle-Vendor: BTC Business Technology Consulting AG
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 0.1.0.qualifier
Bundle-SymbolicName: com.btc.serviceidl.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.btc.serviceidl,
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ide/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.ide</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
6 changes: 3 additions & 3 deletions com.btc.serviceidl.plainjava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.plainjava</artifactId>
<version>1.0.0-SNAPSHOT</version> <!-- version for this module is not inherited from the parent because it is modified during branch deployment (the other projects are not modified because they are OSGi plugins) -->
<version>0.1.0-SNAPSHOT</version> <!-- version for this module is not inherited from the parent because it is modified during branch deployment (the other projects are not modified because they are OSGi plugins) -->

<build>
<plugins>
Expand Down Expand Up @@ -423,7 +423,7 @@
<dependency>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.repository</artifactId>
<packaging>eclipse-repository</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.target/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.target</artifactId>
<packaging>eclipse-target-definition</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.btc.serviceidl.tests
Bundle-ManifestVersion: 2
Bundle-Name: com.btc.serviceidl.tests
Bundle-Vendor: BTC Business Technology Consulting AG
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 0.1.0.qualifier
Bundle-SymbolicName: com.btc.serviceidl.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.btc.serviceidl,
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.btc.serviceidl.ui.tests
Bundle-ManifestVersion: 2
Bundle-Name: com.btc.serviceidl.ui.tests
Bundle-Vendor: BTC Business Technology Consulting AG
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 0.1.0.qualifier
Bundle-SymbolicName: com.btc.serviceidl.ui.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.btc.serviceidl.ui,
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.btc.serviceidl.ui
Bundle-ManifestVersion: 2
Bundle-Name: com.btc.serviceidl.ui
Bundle-Vendor: BTC Business Technology Consulting AG
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 0.1.0.qualifier
Bundle-SymbolicName: com.btc.serviceidl.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.btc.serviceidl,
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl.ui</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: com.btc.serviceidl
Bundle-ManifestVersion: 2
Bundle-Name: com.btc.serviceidl
Bundle-Vendor: BTC Business Technology Consulting AG
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 0.1.0.qualifier
Bundle-SymbolicName: com.btc.serviceidl; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
Expand Down
2 changes: 1 addition & 1 deletion com.btc.serviceidl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.btc.serviceidl</groupId>
<artifactId>com.btc.serviceidl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.btc.serviceidl</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
80 changes: 67 additions & 13 deletions deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,79 @@
#!/bin/bash
set -x -e

BASE_VERSION=1.0.0

if [ "$TRAVIS" != "true" ] ; then
echo "Not running on travis, not supported at the moment"
exit 1
fi

if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then
if [ "$TRAVIS_BRANCH" != "master" ] ; then
BRANCH_FRAGMENT="-${TRAVIS_BRANCH////-}"
else
BRANCH_FRAGMENT=""
cp .travis.settings.xml $HOME/.m2/settings.xml

if [[ "$TRAVIS_BRANCH" =~ ^release/ ]] ; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is TRAVIS_BRANCH set if building a PR?
If not you can skip the check in line 55

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is set for PR builds: "for builds triggered by a pull request this is the name of the branch targeted by the pull request."

RELEASE_VERSION=$(echo "$TRAVIS_BRANCH" | sed -e "s/release[/]//")

if ! [[ "${RELEASE_VERSION}" =~ [0-9]+[.][0-9]+[.][0-9]+ ]] ; then
echo "Invalid branch name: $TRAVIS_BRANCH"
exit 1
fi

POM_VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }'`

if [ "${RELEASE_VERSION}-SNAPSHOT" != "${POM_VERSION}" ] ; then
echo "Branch version ${RELEASE_VERSION} is not a SNAPSHOT or does not match POM version ${POM_VERSION}, assuming release was already done"
exit 0
fi
else
BRANCH_FRAGMENT="-pr${TRAVIS_PULL_REQUEST}"
fi

SNAPSHOT_FRAGMENT="-SNAPSHOT" # TODO suppress on a release tag
# MANIFEST.MF files might have been modified during previous steps, so we need to revert
# these changes before release:prepare
git stash save

cd com.btc.serviceidl.plainjava && mvn versions:set -DnewVersion=${BASE_VERSION}${BRANCH_FRAGMENT}${SNAPSHOT_FRAGMENT}
# Unshallow local repo to allow mvn release to work
git fetch --unshallow
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

mvn deploy -DskipTests
# Checkout branch (travis-ci has checked out the commit hash)
# Note: if the branch has been updated in between, this will use a newer
# revision than before, but for making the release this should not usually
# happen, and should not matter anyway, since the newer revision would be
# used by a subsequent build and overwrite the tag
git checkout $TRAVIS_BRANCH

DEVELOPMENT_VERSION=$(python -c 'version = tuple(map(int, ("'${RELEASE_VERSION}'".split(".")))); print("%i.%i.%i" % (version[0], version[1]+1, 0))')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use python here when you you sed in all other places?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My sed knowledge is quite limited. I copied the sed expression from somewhere, but I wrote this myself ;) In addition, I think incrementing a number is not straight-forward with sed.


mvn -B release:prepare -DreleaseVersion=${RELEASE_VERSION} -DdevelopmentVersion=${DEVELOPMENT_VERSION}-SNAPSHOT

git config remote.origin.url https://sigiesec:${GITHUB_TOKEN}@github.com/btc-ag/service-idl.git
git push origin v${RELEASE_VERSION}
git push

curl --fail -u sigiesec:${GITHUB_TOKEN} -X POST -d '{"title":"Start next development iteration after '${RELEASE_VERSION}' release", "base":"master", "head":"'${TRAVIS_BRANCH}'"}' https://api.github.com/repos/btc-ag/service-idl/pulls
elif [ "$TRAVIS_TAG" == "" ] ; then
SNAPSHOT_FRAGMENT="-SNAPSHOT"
BASE_VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }' | sed -e 's/-SNAPSHOT//'`

if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this checked here?
Is the deploy.sh script even executed on pull request builds and if yes, why?

if [ "$TRAVIS_BRANCH" != "master" ] ; then
BRANCH_FRAGMENT="-${TRAVIS_BRANCH////-}"
else
BRANCH_FRAGMENT=""
fi
else
BRANCH_FRAGMENT="-pr${TRAVIS_PULL_REQUEST}"
fi

cd com.btc.serviceidl.plainjava && mvn versions:set -DnewVersion=${BASE_VERSION}${BRANCH_FRAGMENT}${SNAPSHOT_FRAGMENT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you build the new version from multiple fragments?
Is is not possible to use RELEASE_VERSION or DEVELOPMENT_VERSION for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not changed as part of this PR, it was only moved into the if and the indentation was changed.

RELEASE_VERSION and DEVELOPMENT_VERSION are not set at all in this block.


mvn deploy -DskipTests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvn deploy could be moved outside the if/else because it is executed in both branches.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if release:perform is not used, this could be done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave it at is it for now. Maybe #181 will change this again.

else
# TODO alternatively, release:perform could be executed, but this would check out the same version that we are building right now;
# or, we could run this in the branch build job, and do nothing in the tag build job; the latter would allow us to only push the branch changes if the release was successful

## write release.properties file, since the tag cannot be specified on the command line
#echo scm.url=scm:git:https://github.com/btc-ag/service-idl.git >release.properties
#echo scm.tag=${TRAVIS_TAG} >>release.properties
#rm .meta/p2-artifacts.properties
#mvn -B release:perform

mvn deploy -DskipTests
fi
Loading