Skip to content

Commit

Permalink
Support releasing named Java versions (#454)
Browse files Browse the repository at this point in the history
* Support releasing versions after the fact

Support releasing named versions after main has already changed.

Signed-off-by: Alex Konradi <[email protected]>

* Update Java releasing instructions

Signed-off-by: Alex Konradi <[email protected]>

* Fix bash syntax

Signed-off-by: Alex Konradi <[email protected]>
  • Loading branch information
akonradi authored Mar 31, 2021
1 parent 8459449 commit 1b9f543
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
14 changes: 11 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ jobs:
fingerprints:
- "cd:a8:80:f3:5e:9a:37:30:ef:55:20:b5:1f:b9:e5:18"
- deploy:
command: | # Deploy if on main branch. If the $RELEASE and $NEXT variables are set then prepare a full maven release.
if [ "${CIRCLE_BRANCH}" == "main" ]; then
command: | # Deploy from the main branch or from a version branch/tag. If the $RELEASE and $NEXT variables are set then prepare a full maven release.
if [[ "${CIRCLE_BRANCH}" =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
RELEASE="${CIRCLE_BRANCH}"
NEXT="${CIRCLE_BRANCH}-SNAPSHOT"
DO_RELEASE=1
fi
if [[ "${CIRCLE_BRANCH}" == "main" || -n "${DO_RELEASE}" ]]; then
echo $GPG_KEY | base64 --decode > signing-key
gpg --passphrase $GPG_PASSPHRASE --import signing-key
shred signing-key
if [[ -n "${RELEASE}" && -n "${NEXT}" ]]; then
git config --global user.email "[email protected]"
git config --global user.name "envoy-bot"
mvn -B -s ../.circleci/settings.xml release:prepare release:perform -Darguments="-s ../.circleci/settings.xml" -DreleaseVersion=$RELEASE -DdevelopmentVersion=$NEXT -DscmCommentPrefix="java release: "
mvn -B -s ../.circleci/settings.xml release:prepare release:perform \
-Darguments="-s ../.circleci/settings.xml" \
-DreleaseVersion=$RELEASE -DdevelopmentVersion=$NEXT \
-DscmCommentPrefix="java release: "
else
mvn -B -s ../.circleci/settings.xml deploy
fi
Expand Down
23 changes: 19 additions & 4 deletions java/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ These steps are for releasing the Java components of PGV:
- pgv-java-grpc
- pgv-artifacts

## Releasing from master using CI
## Releasing using CI

Releasing from master is fully automated by CI, but can't release historic tags.
Releasing from main is fully automated by CI:
```
curl -X POST -H "Content-Type: application/json" -d '{
"build_parameters": {
Expand All @@ -16,9 +16,24 @@ curl -X POST -H "Content-Type: application/json" -d '{
"NEXT": "<next-version>-SNAPSHOT",
"GIT_USER_EMAIL": "[email protected]",
"GIT_USER_NAME": "Via CircleCI"
}}' "https://circleci.com/api/v1.1/project/github/envoyproxy/protoc-gen-validate/tree/master?circle-token=<my-token>"
}}' "https://circleci.com/api/v1.1/project/github/envoyproxy/protoc-gen-validate/tree/main?circle-token=<my-token>"
```

Releasing from versioned tags is similar. To release version `vX.Y.Z`, first
create a Git tag called `vX.Y.Z` (preferably through the GitHub release flow),
then run the following to kick off a release build:
```
curl -X POST -H "Content-Type: application/json" -d '{
"build_parameters": {
"CIRCLE_JOB": "javabuild",
"GIT_USER_EMAIL": "[email protected]",
"GIT_USER_NAME": "Via CircleCI"
}}' "https://circleci.com/api/v1.1/project/github/envoyproxy/protoc-gen-validate/tree/v.X.Y.Z?circle-token=<my-token>"
```

The `javabuild` CI flow will use the version number from the tag to deploy to
the Maven repository.

## Manually releasing from git history

Manually releasing from git history is a more involved process, but allows you
Expand All @@ -34,4 +49,4 @@ to release from any point in the history.

```
mvn -B -s /path/to/settings.xml clean release:prepare release:perform -Darguments="-s /path/to/settings.xml" -DreleaseVersion=x.y.z -DdevelopmentVersion=x.y.z-SNAPSHOT -DscmCommentPrefix="java release: "
```
```

0 comments on commit 1b9f543

Please sign in to comment.