Skip to content
10 changes: 10 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The base classes, interfaces and low-level APIs to use CloudEvents.

## How to Use

For Maven based projects, use the following dependency:

```xml
<dependency>
<groupId>io.cloudevents</groupId>
<artifactId>cloudevents-api</artifactId>
<version>2.0.0-milestone1</version>
</dependency>
```

### Create an Event

```java
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The CloudEvents SDK for Java is composed by several modules, each one providing
* [`cloudevents-http-restful-ws`] Implementation of [HTTP Protocol Binding] for [Jakarta Restful WS](https://jakarta.ee/specifications/restful-ws/)
* [`cloudevents-kafka`] Implementation of [Kafka Protocol Binding]

The latest SDK version is _2.0.0-milestone1_.
You can look at the latest published artifacts on [Maven Central](https://search.maven.org/search?q=g:io.cloudevents).

## Get Started

Expand Down
24 changes: 24 additions & 0 deletions scripts/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Release process

The release is automatically performed by Travis CI.

In order to trigger it, you can use the script `trigger_release.sh` like:

```bash
./scripts/trigger_release.sh --release 2.0.0-milestone2 --snapshot 2.1.0-SNAPSHOT --upstream origin
```

This script will:

- Perform a dump of the release using the release version
- Update all the \*.md containing the release version
- Tag and commit all the above changes and eventually push them to the
provided remote
- Perform a dump of the version back to the provided snapshot version
- Commit all the above changes and eventually push them to the provided remote

After the script performed all the changes, you can create the new release on
GitHub: https://github.com/cloudevents/sdk-java/releases/new

Note: Before running it pointing to upstream/master, try always in your local
repo
94 changes: 94 additions & 0 deletions scripts/trigger_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

function die() { echo "$*" 1>&2 ; exit 1; }

# Example usage
# ./scripts/trigger_release.sh --upstream upstream --release 2.0.0 --snapshot 2.1.0-SNAPSHOT

# In order to start the release the script:
# * Performs a dump of the release using the release version
# * Updates all the *.md containing the release version
# * Commits all the above changes and eventually push them to the provided remote
# * Performs a dump of the version back to the provided snapshot version
# * Commits all the above changes and eventually push them to the provided remote

THIS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
REMOTE=""
NEW_SNAPSHOT=""
NEW_VERSION=""

# Loop through arguments and process them
while (( "$#" )); do
case $1 in
-u|--upstream)
if [[ -n $2 ]]; then
REMOTE=$2
shift
else
die 'ERROR: "--upstream" requires a non-empty option argument.'
fi
;;
-r|--release)
if [[ -n $2 ]]; then
NEW_VERSION=$2
shift
else
die 'ERROR: "--version" requires a non-empty option argument.'
fi
;;
-s|--snapshot)
if [[ -n $2 ]]; then
NEW_SNAPSHOT=$2
shift
else
die 'ERROR: "--snapshot" requires a non-empty option argument.'
fi
;;
esac
shift
done

if [ -z "$REMOTE" ]; then
echo "Remote is not specified, I'm gonna perform the changes only locally"
else
echo "Going to release on remote $REMOTE"
fi

if [ -z "$NEW_VERSION" ]; then
die 'ERROR: version is not specified'
fi

if [ -z "$NEW_SNAPSHOT" ]; then
die 'ERROR: new snapshot is not specified'
fi

echo "Dumping to release $NEW_VERSION"

mvn versions:set -DnewVersion="$NEW_VERSION"
find . -name "pom.xml" -exec git add {} \;
sed -i -e "s+<version>[a-zA-Z0-9.-]*<\/version>+<version>$NEW_VERSION</version>+g" ***/*.md
find . -name "*.md" -exec git add {} \;

git commit --signoff -m "Release $NEW_VERSION"
git tag $NEW_VERSION

if [ -n "$REMOTE" ]; then
git push --follow-tags -u $REMOTE $THIS_BRANCH
fi

echo "Dumping to snapshot $NEW_SNAPSHOT"

mvn versions:set -DnewVersion="$NEW_SNAPSHOT"
find . -name "pom.xml" -exec git add {} \;

git commit --signoff -m "Release $NEW_SNAPSHOT"

if [ -n "$REMOTE" ]; then
git push -u $REMOTE $THIS_BRANCH
fi

echo "Done! Now you can create the release on GitHub!"