diff --git a/.github/scripts/local.init.gradle.kts b/.github/scripts/local.init.gradle.kts index 0b8ec23a0fcc..ff27a92de3e8 100644 --- a/.github/scripts/local.init.gradle.kts +++ b/.github/scripts/local.init.gradle.kts @@ -1,3 +1,12 @@ +settingsEvaluated { + settings.pluginManagement { + repositories { + mavenLocal() + removeIf { it.name == "sonatype" } + } + } +} + allprojects { repositories { mavenLocal() diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef3771c337e3..294b365c8081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,7 +315,7 @@ jobs: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Publish snapshot + - name: Build and publish artifact snapshots env: S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }} @@ -324,3 +324,13 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} run: ./gradlew snapshot + + - name: Build and publish gradle plugin snapshots + env: + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + run: ../gradlew build publishToSonatype + working-directory: gradle-plugins + run: ./gradlew snapshot diff --git a/.github/workflows/gradle-plugins-release.yml b/.github/workflows/gradle-plugins-release.yml deleted file mode 100644 index 98dc4a8bdc58..000000000000 --- a/.github/workflows/gradle-plugins-release.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish Gradle plugins to Gradle Plugin Portal - -on: - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 0 - - - name: Set up JDK 11 for running Gradle - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 11 - - - name: Cache Gradle Wrapper - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: Publish plugins - env: - GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} - GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} - run: ../gradlew build publishPlugins - working-directory: gradle-plugins diff --git a/.github/workflows/gradle-plugins-snapshot.yml b/.github/workflows/gradle-plugins-snapshot.yml deleted file mode 100644 index 7e122152f1c4..000000000000 --- a/.github/workflows/gradle-plugins-snapshot.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Publish Gradle plugin snapshots - -on: - push: - paths: - - 'gradle-plugins/**' - - '.github/workflows/gradle-plugins-snapshot.yml' - branches: - - main - workflow_dispatch: - -jobs: - snapshot: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 0 - - - name: Set up JDK 11 for running Gradle - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 11 - - - name: Cache Gradle Wrapper - uses: actions/cache@v2 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - - name: Publish snapshot - env: - SONATYPE_USER: ${{ secrets.SONATYPE_USER }} - SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} - run: ../gradlew build publishToSonatype - working-directory: gradle-plugins \ No newline at end of file diff --git a/.github/workflows/patch-release-build.yml b/.github/workflows/patch-release-build.yml index 74e30918c260..dbf5b7ab4022 100644 --- a/.github/workflows/patch-release-build.yml +++ b/.github/workflows/patch-release-build.yml @@ -248,7 +248,7 @@ jobs: with: job-id: jdk11 remote-build-cache-proxy-enabled: false - arguments: assemble final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }} + arguments: assemble final closeAndReleaseSonatypeStagingRepository env: SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} @@ -257,6 +257,14 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + # TODO (trask) cache gradle wrapper? + - name: Build and publish gradle plugins + env: + GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} + GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} + run: ../gradlew build publishPlugins + working-directory: gradle-plugins + - name: Push cherry-picked changes to the release branch run: git push diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7e9d7d5aacf4..ce457894efb4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -253,8 +253,6 @@ jobs: examples: runs-on: ubuntu-latest - # When we make PR against pre-release branch examples may point to yet-unpublished version - if: github.base_ref == 'main' steps: - uses: actions/checkout@v2.3.4 with: diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 796f821f6f42..dfc06cfbd24c 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -159,7 +159,7 @@ jobs: with: job-id: jdk11 remote-build-cache-proxy-enabled: false - arguments: assemble final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }} + arguments: assemble final closeAndReleaseSonatypeStagingRepository env: SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} @@ -168,6 +168,14 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + # TODO (trask) cache gradle wrapper? + - name: Build and publish gradle plugins + env: + GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} + GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} + run: ../gradlew build publishPlugins + working-directory: gradle-plugins + - name: Create Release id: create_release uses: actions/create-release@v1.1.4 diff --git a/RELEASING.md b/RELEASING.md index 431c6e798cdc..017f400198a3 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -15,6 +15,14 @@ next _minor_ release version. This means version `vX.(Y+1).0-SNAPSHOT`. ## Starting the Release +Before making the release: + +* Update `CHANGELOG.md` +* Update the version (remove `-SNAPSHOT`) in these files: + * version.gradle.kts + * examples/distro/build.gradle + * examples/extension/build.gradle + Open the release build workflow in your browser [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release-build.yml). You will see a button that says "Run workflow". Press the button, enter the version number you want @@ -23,6 +31,13 @@ to release in the input field that pops up, and then press "Run workflow". This triggers the release process, which builds the artifacts, publishes the artifacts, and creates and pushes a git tag with the version number. +After making the release: + +* Update the version (bump and add `-SNAPSHOT`) in these files: + * version.gradle.kts + * examples/distro/build.gradle + * examples/extension/build.gradle + ## Announcement Once the GitHub workflow completes, go to Github [release diff --git a/build.gradle.kts b/build.gradle.kts index 53901f62e893..5748016f206f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ -import nebula.plugin.release.git.opinion.Strategies import java.time.Duration plugins { @@ -6,17 +5,10 @@ plugins { id("com.github.ben-manes.versions") id("io.github.gradle-nexus.publish-plugin") - id("nebula.release") id("otel.spotless-conventions") } -release { - defaultVersionStrategy = Strategies.getSNAPSHOT() -} - -nebulaRelease { - addReleaseBranchPattern("""v\d+\.\d+\.x""") -} +apply(from = "version.gradle.kts") nexusPublishing { packageGroup.set("io.opentelemetry") diff --git a/conventions/build.gradle.kts b/conventions/build.gradle.kts index c912447f065c..89f4c5f9b409 100644 --- a/conventions/build.gradle.kts +++ b/conventions/build.gradle.kts @@ -29,8 +29,8 @@ dependencies { implementation(gradleApi()) implementation(localGroovy()) - implementation("io.opentelemetry.instrumentation.muzzle-generation:io.opentelemetry.instrumentation.muzzle-generation.gradle.plugin:0.8.0") - implementation("io.opentelemetry.instrumentation.muzzle-check:io.opentelemetry.instrumentation.muzzle-check.gradle.plugin:0.8.0") + implementation("io.opentelemetry.instrumentation.muzzle-generation:io.opentelemetry.instrumentation.muzzle-generation.gradle.plugin") + implementation("io.opentelemetry.instrumentation.muzzle-check:io.opentelemetry.instrumentation.muzzle-check.gradle.plugin") implementation("org.eclipse.aether:aether-connector-basic:1.1.0") implementation("org.eclipse.aether:aether-transport-http:1.1.0") diff --git a/conventions/src/main/kotlin/otel.publish-conventions.gradle.kts b/conventions/src/main/kotlin/otel.publish-conventions.gradle.kts index 5d08da336c3b..75a8be439eca 100644 --- a/conventions/src/main/kotlin/otel.publish-conventions.gradle.kts +++ b/conventions/src/main/kotlin/otel.publish-conventions.gradle.kts @@ -19,12 +19,6 @@ publishing { } } - if (findProperty("otel.stable") != "true") { - val versionParts = version.split('-').toMutableList() - versionParts[0] += "-alpha" - version = versionParts.joinToString("-") - } - afterEvaluate { val mavenGroupId: String? by project if (mavenGroupId != null) { @@ -85,10 +79,6 @@ fun artifactPrefix(p: Project, archivesBaseName: String): String { return "opentelemetry-" } -rootProject.tasks.named("release").configure { - finalizedBy(tasks["publishToSonatype"]) -} - // Sign only if we have a key to do so val signingKey: String? = System.getenv("GPG_PRIVATE_KEY") // Stub out entire signing block off of CI since Gradle provides no way of lazy configuration of diff --git a/examples/distro/build.gradle b/examples/distro/build.gradle index 68044fe74e80..6908679949ef 100644 --- a/examples/distro/build.gradle +++ b/examples/distro/build.gradle @@ -29,7 +29,6 @@ subprojects { repositories { mavenCentral() - mavenLocal() maven { name = "sonatype" url = uri("https://oss.sonatype.org/content/repositories/snapshots") diff --git a/examples/distro/settings.gradle b/examples/distro/settings.gradle index c0c40708a6ff..20d00c93547a 100644 --- a/examples/distro/settings.gradle +++ b/examples/distro/settings.gradle @@ -1,3 +1,13 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = "sonatype" + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + } + } +} + rootProject.name = 'opentelemetry-java-instrumentation-distro-demo' include "agent" diff --git a/examples/extension/build.gradle b/examples/extension/build.gradle index a38d36ef751e..3440617f725e 100644 --- a/examples/extension/build.gradle +++ b/examples/extension/build.gradle @@ -12,8 +12,8 @@ plugins { */ id "com.github.johnrengelman.shadow" version "6.1.0" - id "io.opentelemetry.instrumentation.muzzle-generation" version "0.8.0" - id "io.opentelemetry.instrumentation.muzzle-check" version "0.8.0" + id "io.opentelemetry.instrumentation.muzzle-generation" version "1.8.0-alpha-SNAPSHOT" + id "io.opentelemetry.instrumentation.muzzle-check" version "1.8.0-alpha-SNAPSHOT" } group 'io.opentelemetry.example' diff --git a/examples/extension/settings.gradle b/examples/extension/settings.gradle index 763ae16c856b..531daf64fe34 100644 --- a/examples/extension/settings.gradle +++ b/examples/extension/settings.gradle @@ -1,8 +1,8 @@ pluginManagement { repositories { - mavenLocal() gradlePluginPortal() maven { + name = "sonatype" url = uri("https://oss.sonatype.org/content/repositories/snapshots") } } diff --git a/gradle-plugins/build.gradle.kts b/gradle-plugins/build.gradle.kts index ce39ab78f81d..bf4b2eb8b507 100644 --- a/gradle-plugins/build.gradle.kts +++ b/gradle-plugins/build.gradle.kts @@ -9,7 +9,8 @@ plugins { } group = "io.opentelemetry.instrumentation" -version = "0.8.0" + +apply(from = "../version.gradle.kts") repositories { mavenCentral() diff --git a/version.gradle.kts b/version.gradle.kts new file mode 100644 index 000000000000..91a0e0234081 --- /dev/null +++ b/version.gradle.kts @@ -0,0 +1,7 @@ +allprojects { + if (findProperty("otel.stable") != "true") { + version = "1.8.0-alpha-SNAPSHOT" + } else { + version = "1.8.0-SNAPSHOT" + } +}