From 0726767699f51c5282ad9b3138603d692f3da967 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 13 Mar 2026 16:55:13 +0100 Subject: [PATCH 1/3] ci: Publish snapshot builds to Maven Central on push to main Add a `mavenCentralSnapshots` repository to both plugin-build and sentry-kotlin-compiler-plugin build files, and a new GitHub Actions workflow that publishes `-SNAPSHOT` versions on every push to main. This gives consumers early access to unreleased changes without waiting for a formal release. The snapshot flow is completely independent from the existing craft-based release process. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/publish-snapshot.yml | 51 +++++++++++++++++++ plugin-build/build.gradle.kts | 15 ++++++ .../build.gradle.kts | 8 +++ 3 files changed, 74 insertions(+) create mode 100644 .github/workflows/publish-snapshot.yml diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml new file mode 100644 index 000000000..1292e49e7 --- /dev/null +++ b/.github/workflows/publish-snapshot.yml @@ -0,0 +1,51 @@ +name: Publish Snapshot + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish-snapshot: + name: Publish snapshot to Maven Central + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # pin@v4 + + - name: Set up Java + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + with: + distribution: 'temurin' + java-version: '17' + + - name: Determine snapshot version + id: version + run: | + VERSION=$(grep "^version = " plugin-build/gradle.properties | cut -d' ' -f3) + echo "snapshot_version=${VERSION}-SNAPSHOT" >> "$GITHUB_OUTPUT" + + - name: Publish Gradle Plugin snapshot + working-directory: plugin-build + run: > + ../gradlew publishAllPublicationsToMavenCentralSnapshotsRepository + -Pversion=${{ steps.version.outputs.snapshot_version }} + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + + - name: Publish Kotlin Compiler Plugin snapshot + working-directory: sentry-kotlin-compiler-plugin + run: > + ../gradlew publishAllPublicationsToMavenCentralSnapshotsRepository + -PVERSION_NAME=${{ steps.version.outputs.snapshot_version }} + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} diff --git a/plugin-build/build.gradle.kts b/plugin-build/build.gradle.kts index 25fbbf199..f0658126f 100644 --- a/plugin-build/build.gradle.kts +++ b/plugin-build/build.gradle.kts @@ -323,3 +323,18 @@ tasks.withType().configureEach { failOnWarning.set(true) enableStricterValidation.set(true) } + +plugins.withId("com.vanniktech.maven.publish.base") { + configure { + repositories { + maven { + name = "mavenCentralSnapshots" + url = uri("https://central.sonatype.com/repository/maven-snapshots/") + credentials { + username = findProperty("mavenCentralUsername")?.toString() + password = findProperty("mavenCentralPassword")?.toString() + } + } + } + } +} diff --git a/sentry-kotlin-compiler-plugin/build.gradle.kts b/sentry-kotlin-compiler-plugin/build.gradle.kts index 359182c90..2f661e97e 100644 --- a/sentry-kotlin-compiler-plugin/build.gradle.kts +++ b/sentry-kotlin-compiler-plugin/build.gradle.kts @@ -73,6 +73,14 @@ plugins.withId("com.vanniktech.maven.publish.base") { name = "mavenTestRepo" url = file("${rootProject.projectDir}/../build/mavenTestRepo").toURI() } + maven { + name = "mavenCentralSnapshots" + url = uri("https://central.sonatype.com/repository/maven-snapshots/") + credentials { + username = findProperty("mavenCentralUsername")?.toString() + password = findProperty("mavenCentralPassword")?.toString() + } + } } } } From ddd408e5699cd9fedafcba7e8188f0a46718b2b8 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 25 Mar 2026 11:30:01 +0100 Subject: [PATCH 2/3] ci: Disable cancel-in-progress for snapshot publishing Cancelling a running publish can leave the Maven snapshot repository in an inconsistent state (e.g. partial artifacts or mismatched plugin versions between the Gradle Plugin and Kotlin Compiler Plugin). Queuing instead ensures each publish completes atomically. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/publish-snapshot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 1292e49e7..81bba8cf1 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -7,7 +7,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: false jobs: publish-snapshot: From 3fd92aa59da720d81b6bc0a4c19cc1dd6522bc3a Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 25 Mar 2026 11:42:09 +0100 Subject: [PATCH 3/3] Update .github/workflows/publish-snapshot.yml Co-authored-by: Burak Yigit Kaya --- .github/workflows/publish-snapshot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 81bba8cf1..0026ef6d7 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -13,6 +13,7 @@ jobs: publish-snapshot: name: Publish snapshot to Maven Central runs-on: ubuntu-latest + environment: production steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6