Skip to content

Commit

Permalink
Add automatic release support (#1024)
Browse files Browse the repository at this point in the history
* Initial support for automatic artifacts release.

* Try out version 0.2.4

* Use 1GB ram as the build task.

* Restore original version.

* Add RELEASE.md

* Minor style fixes.

* Fixes.
  • Loading branch information
carlosalberto authored Mar 20, 2020
1 parent 73e671d commit 6f0c44a
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ verify_task: &verify_task
publish_snapshots_task: &publish_snapshots_task
name: Publish Snapshot Artifacts
command: make publish-snapshots
publish_release_task: &publish_release_task
name: Publish Release Artifacts
command: make publish-release-artifacts

jobs:
build:
Expand Down Expand Up @@ -76,10 +79,43 @@ jobs:
paths:
- ~/.gradle
key: java11-gradle-{{ checksum "build.gradle" }}
# Publish the released artifacts using the `build` job env.
release_job:
environment:
# Configure the JVM and Gradle to avoid OOM errors
_JAVA_OPTIONS: "-Xmx1g"
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
docker:
- image: circleci/openjdk:8-jdk
steps:
- checkout
- restore_cache:
keys:
- gradle-{{ checksum "build.gradle" }}
- run:
<<: *init_task
- run:
<<: *verify_task
- run:
<<: *build_task
- run:
<<: *publish_release_task
- save_cache:
paths:
- ~/.gradle
key: gradle-{{ checksum "build.gradle" }}

workflows:
version: 2
build_and_test:
jobs:
- build
- java11
build_and_release:
jobs:
- release_job:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ publish-snapshots:
ifeq ($(CIRCLE_BRANCH),master)
./gradlew artifactoryPublish
endif

.PHONY: publish-release-artifacts
publish-release-artifacts:
./gradlew bintrayUpload
54 changes: 54 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# OpenTelemetry Release Process

This repository uses semantic versioning. Please keep this in mind when choosing version numbers.

1. **Crease a version branch to release from.**

A version branch must be used to do the release in order to prevent commit race conditions.

1. **Update CHANGELOG.**

Update CHANGELOG.md with a list changes since the last release. Each entry must include the release number,
date and a bulleted list of changes where each change is summarized in a single sentence, e.g.
"- Updated the Jaeger exporter to use the last gRPC version".

1. **Update the version.**

Update the version to the desired value in `build.gradle`, e.g. `version = "1.2.3"`. Make sure no `SNAPSHOT`
sufix is appended (that is **only** used during development and when deploying snapshots, as the word implies).

1. **Push a git tag.**

The tag should be of the format `vN.M.L`, e.g. `git tag v1.2.3; git push origin v1.2.3`. It is recommended
to have this tag marked in Github along with the CHANGELOG for this version.

1. **Wait for Circle CI.**

This part is controlled by the Bintray plugin. It publishes the artifacts and syncs to Maven Central.

## Release candidates

Release candidate artifacts are released using the same process described above. The version schema for release candidates
is`v1.2.3-RC$`, where `$` denotes a release candidate version, e.g. `v1.2.3-RC1`.

## Credentials

The following credentials are required for publishing (and automatically set in Circle CI):

* `BINTRAY_USER` and `BINTRAY_KEY`: Bintray username and API Key.
See [this](https://www.jfrog.com/confluence/display/BT/Bintray+Security#BintraySecurity-APIKeys).

* `SONATYPE_USER` and `SONATYPE_KEY`: Sonatype username and password.

## Releasing from the local setup

Releasing from the local setup can be done providing the previously mentioned four credential values, i.e.
`BINTRAY_KEY`, `BINTRAY_USER`, `SONATYPE_USER` and `SONATYPE_KEY`:

```sh
export BINTRAY_USER=my_bintray_user
export BINTRAY_KEY=my_user_api_key
export SONATYPE_USER=my_maven_user
export SONATYPE_KEY=my_maven_password
make publish-release-artifacts
```
36 changes: 35 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "com.github.sherter.google-java-format" apply false
id "com.jfrog.artifactory" apply false
id "com.jfrog.bintray" version "1.8.4" apply false // Need *specific* version.
id "net.ltgt.errorprone" apply false
id "ru.vyarus.animalsniffer" apply false
id "io.morethan.jmhreport" apply false
Expand Down Expand Up @@ -262,8 +263,9 @@ subprojects {
}

plugins.withId("maven-publish") {
// Always include the artifactory plugin to do the deployment.
// Always include the artifactory/bintray plugins to do the deployment.
pluginManager.apply "com.jfrog.artifactory"
pluginManager.apply "com.jfrog.bintray"

publishing {
publications {
Expand Down Expand Up @@ -329,6 +331,38 @@ subprojects {
repoKey = 'libs-release'
}
}

// Release artifacts publishing.
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_KEY")
publications = ['mavenPublication']

publish = true

pkg {
repo = 'maven'
name = 'opentelemetry-java'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/open-telemetry/opentelemetry-java.git'
userOrg = 'open-telemetry'

githubRepo = 'open-telemetry/opentelemetry-java'

version {
name = project.version

gpg {
sign = true
}

mavenCentralSync {
user = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_KEY")
}
}
}
}
}
}

Expand Down

0 comments on commit 6f0c44a

Please sign in to comment.