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

Publish muzze plugins to Gradle Plugin Portal only when manually requested #3763

Merged
merged 1 commit into from
Aug 4, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Publish Gradle plugin snapshots
name: Publish Gradle plugins to Gradle Plugin Portal

on:
push:
paths:
- 'gradle-plugins/**'
- '.github/workflows/gradle-plugins.yml'
branches:
- main
workflow_dispatch:

jobs:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/gradle-plugins-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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 checks
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
23 changes: 23 additions & 0 deletions gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
`maven-publish`

id("com.gradle.plugin-publish")
id("io.github.gradle-nexus.publish-plugin")
}

group = "io.opentelemetry.instrumentation"
Expand Down Expand Up @@ -53,9 +54,31 @@ gradlePlugin {
plugins {
get("io.opentelemetry.instrumentation.muzzle-generation").apply {
displayName = "Muzzle safety net generation"
description = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/muzzle.md"
}
get("io.opentelemetry.instrumentation.muzzle-check").apply {
displayName = "Checks instrumented libraries against muzzle safety net"
description = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/muzzle.md"
}
}
}

nexusPublishing {
packageGroup.set("io.opentelemetry")

repositories {
sonatype {
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_KEY"))
}
}

connectTimeout.set(Duration.ofMinutes(5))
clientTimeout.set(Duration.ofMinutes(5))
}

tasks {
publishPlugins {
enabled = !version.toString().contains("SNAPSHOT")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should version above be changed back to SNAPSHOT for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want to publish this to Gradle Portal. The whole idea of the previous PR was to achieve that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is enabled setting here needed, since we only run publishPlugins from manual workflow? is it just for safety?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly for safety, yes. I tried to disable publishToSonatype as well, but it gradle did not find such task :( Probably some evaluation order or rule magic :(

}
}
1 change: 1 addition & 0 deletions gradle-plugins/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pluginManagement {
plugins {
id("com.gradle.plugin-publish") version "0.15.0"
id("org.jetbrains.kotlin.jvm") version "1.5.10"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
}