diff --git a/.github/scripts/api-changes.sh b/.github/scripts/api-changes.sh new file mode 100644 index 0000000..13776be --- /dev/null +++ b/.github/scripts/api-changes.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Prints the Envoy releases from the given version on whose API differs from the release before, oldest first. +# Compares descriptors without source info, so changes to comments don't count: they don't change the generated +# classes. Buf stamps its module commit into each descriptor, which changes even when the protos don't, so that's +# dropped. Needs the buf CLI. +set -euo pipefail +min="$1" +last="" +for v in $("$(dirname "$0")/envoy-releases.sh"); do + if [ "$(printf '%s\n%s\n' "${min}" "${v}" | sort -V | head -1)" != "${min}" ]; then + continue + fi + api=$(buf build "buf.build/envoyproxy/envoy:v${v}" --exclude-source-info -o -#format=json \ + | jq -cS '.file | map(del(.bufExtension)) | sort_by(.name)' | sha256sum) + if [ "${api}" != "${last}" ]; then + echo "${v}" + fi + last="${api}" +done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e98b560..b74a70e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: "Release" -# Publishes every Envoy release (as labelled in the Buf registry) that has no v tag here yet. +# Publishes every Envoy release (as labelled in the Buf registry) that has no v tag here yet, skipping releases +# whose API is the same as the release before (see .github/scripts/api-changes.sh). # Does nothing until the repository variable PUBLISH is set to "true" and the Maven Central secrets exist. on: @@ -25,7 +26,7 @@ jobs: permissions: contents: write # push release tags env: - MIN_ENVOY_VERSION: "1.31.0" # oldest release Envoy labels in the Buf registry + MIN_ENVOY_VERSION: "1.36.0" # oldest Envoy release upstream still supports MAX_RELEASES_PER_RUN: "5" # a build takes several minutes; later runs catch up on a backlog SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} @@ -55,7 +56,7 @@ jobs: if [ -n "${ENVOY_VERSION}" ]; then versions="${ENVOY_VERSION}" else - versions=$(.github/scripts/envoy-releases.sh) + versions=$(.github/scripts/api-changes.sh "${MIN_ENVOY_VERSION}") fi published=0 @@ -64,9 +65,6 @@ jobs: echo "Published ${published}; leaving the rest for the next run" break fi - if [ "$(printf '%s\n%s\n' "${MIN_ENVOY_VERSION}" "${v}" | sort -V | head -1)" != "${MIN_ENVOY_VERSION}" ]; then - continue - fi release="${v}${BUILD_NUMBER:+-${BUILD_NUMBER}}" if git rev-parse -q --verify "refs/tags/v${release}" >/dev/null; then continue diff --git a/README.md b/README.md index 6b73543..89167fb 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,14 @@ Java protobuf and gRPC classes for the [Envoy](https://www.envoyproxy.io/) xDS A ## Versioning Each release is built from one Envoy release and carries its version: `1.40.0` is Envoy 1.40.0's API. A rebuild of the -same Envoy release gets a suffix, e.g. `1.40.0-1`. Use the version matching the Envoy you run, or any later one: the v3 -API only grows, and older Envoys ignore fields they don't know (see Envoy's +same Envoy release gets a suffix, e.g. `1.40.0-1`. An Envoy release whose API is the same as the release before isn't +published, e.g. there's no 1.36.1 because its API is 1.36.0's. Most patch releases change no protos, or only comments. So use the newest version that isn't newer than +the Envoy you run, or any later one: the v3 API only grows, and older Envoys ignore fields they don't know (see Envoy's [API versioning policy](https://github.com/envoyproxy/envoy/blob/main/api/API_VERSIONING.md)). +The javadoc jar only links to [Envoy's API docs](https://www.envoyproxy.io/docs/envoy/latest/api-v3/api); the sources +jar has the generated code. + The classes are generated with protoc 3.25, so they run on protobuf-java 3.25+ and 4.x. ## How it's built @@ -34,8 +38,10 @@ dependency to `api/buf.yaml`. ## Releasing -`.github/workflows/release.yml` runs daily. It publishes every Envoy release from 1.31.0 on that has no `v` -tag in this repository yet, then tags it. Run it by hand to publish one version, or a rebuild with a build number. +`.github/workflows/release.yml` runs daily. It publishes every Envoy release from 1.36.0 (the oldest upstream still +supports) that has no `v` tag in this repository yet, then tags it. It skips releases whose API is the same +as the release before: `.github/scripts/api-changes.sh` compares their descriptors, leaving out comments, which don't +change the generated classes. Run it by hand to publish one version, or a rebuild with a build number. It does nothing until the repository variable `PUBLISH` is `true`, and needs these secrets: `SONATYPE_USER`, `SONATYPE_PASSWORD` (a Maven Central Portal user token), `OSS_SIGNING_KEY` and `OSS_SIGNING_PASSWORD`. diff --git a/build.gradle b/build.gradle index 818951a..4358886 100644 --- a/build.gradle +++ b/build.gradle @@ -43,12 +43,10 @@ tasks.withType(Jar).configureEach { } } -tasks.withType(Javadoc).configureEach { - options.addStringOption('Xdoclint:none', '-quiet') - options.encoding = 'UTF-8' - options.charSet = 'UTF-8' - options.docEncoding = 'UTF-8' -} +// Central requires a javadoc jar, but javadoc of the generated code is over half of each release (~55 MB) and counts +// against Central's publishing limits. The sources jar serves IDEs, so the javadoc jar only points to Envoy's docs. +tasks.named("javadoc") { enabled = false } +tasks.named("javadocJar", Jar) { from("javadoc/README.md") } def grpcVersion = '1.79.0' // Generated code runs on this protobuf-java major and the next, so 3.x gencode suits both 3.x and 4.x users. diff --git a/javadoc/README.md b/javadoc/README.md new file mode 100644 index 0000000..4ce3de4 --- /dev/null +++ b/javadoc/README.md @@ -0,0 +1,5 @@ +# envoy-api + +Java classes generated from the Envoy xDS API protos. The protos are documented in +[Envoy's API reference](https://www.envoyproxy.io/docs/envoy/latest/api-v3/api), and the generated code is in the +sources jar.