Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support releasing named Java versions #454

Merged
merged 4 commits into from Mar 31, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions .circleci/config.yml
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 "envoy-bot@users.noreply.github.com"
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
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": "envoy-bot@users.noreply.github.com",
"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": "envoy-bot@users.noreply.github.com",
"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: "
```
```