Skip to content

Commit 68ebe2c

Browse files
authored
fix: plugin publication (#252)
* Fix * Update * Update upload artifact to v4 * Update workflow name * update * Update * Remove previous archive distribution jobs * only do it for release branches * formatting
1 parent c36d0b4 commit 68ebe2c

File tree

5 files changed

+78
-68
lines changed

5 files changed

+78
-68
lines changed

.github/workflows/kotlin-multiplatform-gradle-plugin.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,4 @@ jobs:
4545
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # pin@v4
4646
with:
4747
name: sentry-kotlin-multiplatform-gradle-plugin
48-
token: ${{ secrets.CODECOV_TOKEN }}
49-
50-
archive-distribution:
51-
runs-on: ubuntu-latest
52-
53-
steps:
54-
- uses: actions/checkout@v4
55-
56-
- name: JDK setup
57-
uses: actions/setup-java@v3
58-
with:
59-
java-version: 17
60-
distribution: temurin
61-
62-
- name: Cached Gradle
63-
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
64-
65-
- name: DistZip
66-
run: |
67-
cd sentry-kotlin-multiplatform-gradle-plugin && ./gradlew distZip
68-
69-
- name: Archive packages
70-
uses: actions/upload-artifact@v3
71-
with:
72-
name: ${{ github.sha }}
73-
if-no-files-found: error
74-
path: |
75-
./*/build/distributions/*.zip
48+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/kotlin-multiplatform.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,3 @@ jobs:
113113
- name: Test samples
114114
run: |
115115
./gradlew allTests -p sentry-samples
116-
117-
archive-distribution:
118-
runs-on: macos-latest-xlarge
119-
120-
steps:
121-
- uses: actions/checkout@v4
122-
123-
- name: JDK setup
124-
uses: actions/setup-java@v3
125-
with:
126-
java-version: 17
127-
distribution: temurin
128-
129-
- name: Cached Gradle
130-
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
131-
132-
- name: DistZip
133-
run: |
134-
./scripts/build-distribution.sh sentry-kotlin-multiplatform
135-
136-
- name: Archive packages
137-
uses: actions/upload-artifact@v4
138-
with:
139-
name: ${{ github.sha }}
140-
if-no-files-found: error
141-
path: |
142-
./*/build/distributions/*.zip
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Generate and upload distributions"
2+
on:
3+
push:
4+
branches:
5+
- release/**
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
archive-distribution:
13+
runs-on: macos-latest-xlarge
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: JDK setup
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: 17
22+
distribution: temurin
23+
24+
- name: Cached Gradle
25+
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
26+
27+
- name: DistZip libraries
28+
run: |
29+
./gradlew distZip
30+
31+
- name: DistZip plugin
32+
run: |
33+
cd sentry-kotlin-multiplatform-gradle-plugin
34+
./gradlew distZip sentryPluginMarkerDistZip
35+
36+
- name: Archive packages
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: ${{ github.sha }}
40+
if-no-files-found: error
41+
path: |
42+
./*/build/distributions/*.zip

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tasks.withType<KotlinCompile> { kotlinOptions { jvmTarget = JavaVersion.VERSION_
4040

4141
gradlePlugin {
4242
plugins {
43-
create(property("id").toString()) {
43+
register("sentryPlugin") {
4444
id = property("id").toString()
4545
implementationClass = property("implementationClass").toString()
4646
}
@@ -52,32 +52,39 @@ val publish = extensions.getByType(MavenPublishPluginExtension::class.java)
5252
// via gpg:sign-and-deploy-file (release.kts)
5353
publish.releaseSigningEnabled = false
5454

55-
tasks.named("distZip").configure {
55+
tasks.named("distZip") {
5656
dependsOn("publishToMavenLocal")
57-
this.doLast {
58-
val distributionFilePath =
59-
"${project.layout.buildDirectory.asFile.get().path}${sep}distributions${sep}${project.name}-${project.version}.zip"
60-
val file = File(distributionFilePath)
61-
if (!file.exists()) {
62-
throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
63-
}
64-
if (file.length() == 0L) {
65-
throw IllegalStateException("Distribution file: $distributionFilePath is empty")
57+
onlyIf {
58+
inputs.sourceFiles.isEmpty.not().also {
59+
require(it) { "No distribution to zip." }
6660
}
6761
}
6862
}
6963

70-
val sep = File.separator
64+
val sep: String = File.separator
7165

7266
distributions {
7367
main {
7468
contents {
7569
from("build${sep}libs")
76-
from("build${sep}publications${sep}maven")
70+
from("build${sep}publications${sep}pluginMaven")
71+
}
72+
}
73+
create("sentryPluginMarker") {
74+
contents {
75+
from("build${sep}publications${sep}sentryPluginPluginMarkerMaven")
7776
}
7877
}
7978
}
8079

80+
tasks.named("sentryPluginMarkerDistTar") {
81+
mustRunAfter("generatePomFileForSentryPluginPluginMarkerMavenPublication")
82+
}
83+
84+
tasks.named("sentryPluginMarkerDistZip") {
85+
mustRunAfter("generatePomFileForSentryPluginPluginMarkerMavenPublication")
86+
}
87+
8188
buildConfig {
8289
useKotlinOutput()
8390
packageName("io.sentry")

sentry-kotlin-multiplatform-gradle-plugin/gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,18 @@ versionName=0.7.1
44
group=io.sentry
55
# TODO: Update update-cocoa.sh so the cocoa version is auto updated as well
66
sentryCocoaVersion=8.26.0
7+
8+
# publication pom properties
9+
POM_NAME=Sentry Kotlin Multiplatform Gradle Plugin
10+
POM_DESCRIPTION=Sentry Kotlin Multiplatform Gradle Plugin
11+
POM_URL=https://github.com/getsentry/sentry-kotlin-multiplatform
12+
POM_SCM_URL=https://github.com/getsentry/sentry-kotlin-multiplatform
13+
POM_SCM_CONNECTION=scm:git:git://github.com/getsentry/sentry-kotlin-multiplatform.git
14+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/getsentry/sentry-kotlin-multiplatform.git
15+
16+
POM_LICENCE_NAME=MIT
17+
POM_LICENCE_URL=https://github.com/getsentry/sentry-kotlin-multiplatform/blob/main/LICENSE
18+
19+
POM_DEVELOPER_ID=getsentry
20+
POM_DEVELOPER_NAME=Sentry Team and Contributors
21+
POM_DEVELOPER_URL=https://github.com/getsentry/

0 commit comments

Comments
 (0)