Release automation (#191)

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This commit is contained in:
Francesco Guardiani 2020-09-01 11:35:53 +02:00 committed by GitHub
parent 0ca907be49
commit c61f87f4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 129 additions and 1 deletions

View File

@ -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

View File

@ -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

24
scripts/release.md Normal file
View File

@ -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
scripts/trigger_release.sh Executable file
View File

@ -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!"