Skip to content

Commit b4188f1

Browse files
runningcodeclaude
andcommitted
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) <noreply@anthropic.com>
1 parent 99fa709 commit b4188f1

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
publish-snapshot:
14+
name: Publish snapshot to Maven Central
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
20+
- name: Setup Gradle
21+
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # pin@v4
22+
23+
- name: Set up Java
24+
uses: actions/setup-java@v5
25+
with:
26+
distribution: 'temurin'
27+
java-version: '17'
28+
29+
- name: Determine snapshot version
30+
id: version
31+
run: |
32+
VERSION=$(grep "^version = " plugin-build/gradle.properties | cut -d' ' -f3)
33+
echo "snapshot_version=${VERSION}-SNAPSHOT" >> "$GITHUB_OUTPUT"
34+
35+
- name: Publish Gradle Plugin snapshot
36+
working-directory: plugin-build
37+
run: >
38+
../gradlew publishAllPublicationsToMavenCentralSnapshotsRepository
39+
-Pversion=${{ steps.version.outputs.snapshot_version }}
40+
env:
41+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
42+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
43+
44+
- name: Publish Kotlin Compiler Plugin snapshot
45+
working-directory: sentry-kotlin-compiler-plugin
46+
run: >
47+
../gradlew publishAllPublicationsToMavenCentralSnapshotsRepository
48+
-PVERSION_NAME=${{ steps.version.outputs.snapshot_version }}
49+
env:
50+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
51+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}

plugin-build/build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,18 @@ tasks.withType<ValidatePlugins>().configureEach {
308308
failOnWarning.set(true)
309309
enableStricterValidation.set(true)
310310
}
311+
312+
plugins.withId("com.vanniktech.maven.publish.base") {
313+
configure<PublishingExtension> {
314+
repositories {
315+
maven {
316+
name = "mavenCentralSnapshots"
317+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
318+
credentials {
319+
username = findProperty("mavenCentralUsername")?.toString()
320+
password = findProperty("mavenCentralPassword")?.toString()
321+
}
322+
}
323+
}
324+
}
325+
}

sentry-kotlin-compiler-plugin/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ plugins.withId("com.vanniktech.maven.publish.base") {
7373
name = "mavenTestRepo"
7474
url = file("${rootProject.projectDir}/../build/mavenTestRepo").toURI()
7575
}
76+
maven {
77+
name = "mavenCentralSnapshots"
78+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
79+
credentials {
80+
username = findProperty("mavenCentralUsername")?.toString()
81+
password = findProperty("mavenCentralPassword")?.toString()
82+
}
83+
}
7684
}
7785
}
7886
}

0 commit comments

Comments
 (0)