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

Release automation #1154

Merged
merged 12 commits into from
Oct 16, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
REQUIRE_PROTO_UP_TO_DATE: true
run: |
./mvnw clean install
./mvnw javadoc:javadoc
./mvnw javadoc:javadoc -P release # just to check if javadoc is generated
11 changes: 2 additions & 9 deletions .github/workflows/github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,10 @@ jobs:
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
#- name: Install Dart Sass
# run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Build client_java
run: ./mvnw -B clean install -DskipTests
run: ./mvnw -B clean install -DskipTests -P release
- name: Make Javadoc
run: ./mvnw -B clean compile javadoc:javadoc javadoc:aggregate
run: ./mvnw -B clean compile javadoc:javadoc javadoc:aggregate -P release
- name: Move the Javadoc to docs/static/api/
run: mv ./target/reports/apidocs ./docs/static/api && echo && echo 'ls ./docs/static/api' && ls ./docs/static/api
- name: Setup Pages
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to Maven Central

#on:
# push:
# tags:
# - v*
on:
push:
branches: [ "main" ]
# pull_request:
# branches: [ "main" ]

jobs:
deploy:
if: ${{ github.repository == 'prometheus/client_java' }}
runs-on: ubuntu-latest

steps:
- name: Checkout Plugin Repository
uses: actions/checkout@v4

- name: Set Up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: 'maven'

- name: Build with Maven
run: mvn -B package -P release -Dmaven.test.skip=true

- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Apache Maven Central
run: mvn deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_MAVEN_REPOSITORY_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_REPOSITORY_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ Run `./mvnw spotless:apply` to format the code (only changed files) before commi
If you're getting errors when running tests:

- Make sure that the IDE uses only the "Maven Shade" dependency of "prometheus-metrics-exposition-formats" and the "prometheus-metrics-tracer*" dependencies.

## Updating the Protobuf Java Classes

Use `PROTO_GENERATION=true mvn clean install` to generate protobuf classes.
71 changes: 0 additions & 71 deletions MAINTAINER_NOTES.md

This file was deleted.

25 changes: 25 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Update Version

In a new PR, update the version in `pom.xml` using

```shell
mvn versions:set -DnewVersion=<VERSION>
```

Commit the changes and open a PR.

## Publish Release via Github Workflow

On main branch, create a tag for the new version to trigger the release workflow.

```sh
git tag -a v<VERSION> -m "Release v<VERSION>"
git push origin v<VERSION>
```

## Create a Release

1. Go to https://github.com/prometheus/client_java/releases
2. Click on "Choose a tag", enter the tag name (e.g. `v0.1.0`), and click "Create a new tag".
3. Click on "Generate release notes" to auto-generate the release notes based on the commits since the last release.
4. Click on "Publish release".
3 changes: 1 addition & 2 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>client_java</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>benchmarks</artifactId>
Expand All @@ -20,7 +20,6 @@
<jmh.version>1.37</jmh.version>
<simpleclient.version>0.16.0</simpleclient.version>
<codahale.version>3.0.2</codahale.version>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>example-exemplars-tail-sampling</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-greeting-service</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>example-exemplars-tail-sampling</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-hello-world-app</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-exemplars-tail-sampling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-exemplars-tail-sampling</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-exporter-httpserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-exporter-httpserver</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-exporter-multi-target/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-exporter-multi-target</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-exporter-opentelemetry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-exporter-opentelemetry</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-exporter-servlet-tomcat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-exporter-servlet-tomcat</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-native-histogram/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-native-histogram</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-prometheus-properties/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-prometheus-properties</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-simpleclient-bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>examples</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>example-simpleclient-bridge</artifactId>
Expand Down
6 changes: 1 addition & 5 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>client_java</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>examples</artifactId>
Expand All @@ -16,10 +16,6 @@
Example projects for the Prometheus Metrics Library.
</description>

<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>

<modules>
<module>example-exemplars-tail-sampling</module>
<module>example-exporter-servlet-tomcat</module>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/it-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>integration-tests</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>it-exporter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-exporter-httpserver-sample</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>it-exporter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-exporter-servlet-jetty-sample</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>it-exporter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-exporter-servlet-tomcat-sample</artifactId>
Expand Down
6 changes: 1 addition & 5 deletions integration-tests/it-exporter/it-exporter-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>it-exporter</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-exporter-test</artifactId>
Expand All @@ -16,10 +16,6 @@
Integration Tests for Exporters
</description>

<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>

<dependencies>
<dependency>
<groupId>io.prometheus</groupId>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/it-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>integration-tests</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-exporter</artifactId>
Expand Down
6 changes: 1 addition & 5 deletions integration-tests/it-pushgateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus</groupId>
<artifactId>integration-tests</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>0.0.1-releasetest1</version>
</parent>

<artifactId>it-pushgateway</artifactId>
Expand All @@ -16,10 +16,6 @@
Integration tests for the Pushgateway Exporter
</description>

<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>

<dependencies>
<dependency>
<groupId>io.prometheus</groupId>
Expand Down
Loading