Skip to content

Commit

Permalink
Publish muzze plugins to Gradle Plugin Portal only when manually requ…
Browse files Browse the repository at this point in the history
…ested. (#3763)

Restored publishing to Sonatype OSS repository on every change
  • Loading branch information
iNikem authored Aug 4, 2021
1 parent f96e545 commit 32351d0
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 7 deletions.
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/[email protected]
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")
}
}
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"
}
}

0 comments on commit 32351d0

Please sign in to comment.