Skip to content

Commit c61f87f

Browse files
Release automation (#191)
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
1 parent 0ca907b commit c61f87f

File tree

4 files changed

+129
-1
lines changed

4 files changed

+129
-1
lines changed

core/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ The base classes, interfaces and low-level APIs to use CloudEvents.
66

77
## How to Use
88

9+
For Maven based projects, use the following dependency:
10+
11+
```xml
12+
<dependency>
13+
<groupId>io.cloudevents</groupId>
14+
<artifactId>cloudevents-api</artifactId>
15+
<version>2.0.0-milestone1</version>
16+
</dependency>
17+
```
18+
919
### Create an Event
1020

1121
```java

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The CloudEvents SDK for Java is composed by several modules, each one providing
4343
* [`cloudevents-http-restful-ws`] Implementation of [HTTP Protocol Binding] for [Jakarta Restful WS](https://jakarta.ee/specifications/restful-ws/)
4444
* [`cloudevents-kafka`] Implementation of [Kafka Protocol Binding]
4545

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

4848
## Get Started
4949

scripts/release.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Release process
2+
3+
The release is automatically performed by Travis CI.
4+
5+
In order to trigger it, you can use the script `trigger_release.sh` like:
6+
7+
```bash
8+
./scripts/trigger_release.sh --release 2.0.0-milestone2 --snapshot 2.1.0-SNAPSHOT --upstream origin
9+
```
10+
11+
This script will:
12+
13+
- Perform a dump of the release using the release version
14+
- Update all the \*.md containing the release version
15+
- Tag and commit all the above changes and eventually push them to the
16+
provided remote
17+
- Perform a dump of the version back to the provided snapshot version
18+
- Commit all the above changes and eventually push them to the provided remote
19+
20+
After the script performed all the changes, you can create the new release on
21+
GitHub: https://github.com/cloudevents/sdk-java/releases/new
22+
23+
Note: Before running it pointing to upstream/master, try always in your local
24+
repo

scripts/trigger_release.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
function die() { echo "$*" 1>&2 ; exit 1; }
8+
9+
# Example usage
10+
# ./scripts/trigger_release.sh --upstream upstream --release 2.0.0 --snapshot 2.1.0-SNAPSHOT
11+
12+
# In order to start the release the script:
13+
# * Performs a dump of the release using the release version
14+
# * Updates all the *.md containing the release version
15+
# * Commits all the above changes and eventually push them to the provided remote
16+
# * Performs a dump of the version back to the provided snapshot version
17+
# * Commits all the above changes and eventually push them to the provided remote
18+
19+
THIS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
20+
REMOTE=""
21+
NEW_SNAPSHOT=""
22+
NEW_VERSION=""
23+
24+
# Loop through arguments and process them
25+
while (( "$#" )); do
26+
case $1 in
27+
-u|--upstream)
28+
if [[ -n $2 ]]; then
29+
REMOTE=$2
30+
shift
31+
else
32+
die 'ERROR: "--upstream" requires a non-empty option argument.'
33+
fi
34+
;;
35+
-r|--release)
36+
if [[ -n $2 ]]; then
37+
NEW_VERSION=$2
38+
shift
39+
else
40+
die 'ERROR: "--version" requires a non-empty option argument.'
41+
fi
42+
;;
43+
-s|--snapshot)
44+
if [[ -n $2 ]]; then
45+
NEW_SNAPSHOT=$2
46+
shift
47+
else
48+
die 'ERROR: "--snapshot" requires a non-empty option argument.'
49+
fi
50+
;;
51+
esac
52+
shift
53+
done
54+
55+
if [ -z "$REMOTE" ]; then
56+
echo "Remote is not specified, I'm gonna perform the changes only locally"
57+
else
58+
echo "Going to release on remote $REMOTE"
59+
fi
60+
61+
if [ -z "$NEW_VERSION" ]; then
62+
die 'ERROR: version is not specified'
63+
fi
64+
65+
if [ -z "$NEW_SNAPSHOT" ]; then
66+
die 'ERROR: new snapshot is not specified'
67+
fi
68+
69+
echo "Dumping to release $NEW_VERSION"
70+
71+
mvn versions:set -DnewVersion="$NEW_VERSION"
72+
find . -name "pom.xml" -exec git add {} \;
73+
sed -i -e "s+<version>[a-zA-Z0-9.-]*<\/version>+<version>$NEW_VERSION</version>+g" ***/*.md
74+
find . -name "*.md" -exec git add {} \;
75+
76+
git commit --signoff -m "Release $NEW_VERSION"
77+
git tag $NEW_VERSION
78+
79+
if [ -n "$REMOTE" ]; then
80+
git push --follow-tags -u $REMOTE $THIS_BRANCH
81+
fi
82+
83+
echo "Dumping to snapshot $NEW_SNAPSHOT"
84+
85+
mvn versions:set -DnewVersion="$NEW_SNAPSHOT"
86+
find . -name "pom.xml" -exec git add {} \;
87+
88+
git commit --signoff -m "Release $NEW_SNAPSHOT"
89+
90+
if [ -n "$REMOTE" ]; then
91+
git push -u $REMOTE $THIS_BRANCH
92+
fi
93+
94+
echo "Done! Now you can create the release on GitHub!"

0 commit comments

Comments
 (0)