diff --git a/.github/workflows/kotlin-multiplatform-gradle-plugin.yml b/.github/workflows/kotlin-multiplatform-gradle-plugin.yml index 719a3a58..646ecdd2 100644 --- a/.github/workflows/kotlin-multiplatform-gradle-plugin.yml +++ b/.github/workflows/kotlin-multiplatform-gradle-plugin.yml @@ -45,31 +45,4 @@ jobs: uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # pin@v4 with: name: sentry-kotlin-multiplatform-gradle-plugin - token: ${{ secrets.CODECOV_TOKEN }} - - archive-distribution: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: JDK setup - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - - name: Cached Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a - - - name: DistZip - run: | - cd sentry-kotlin-multiplatform-gradle-plugin && ./gradlew distZip - - - name: Archive packages - uses: actions/upload-artifact@v3 - with: - name: ${{ github.sha }} - if-no-files-found: error - path: | - ./*/build/distributions/*.zip + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/kotlin-multiplatform.yml b/.github/workflows/kotlin-multiplatform.yml index 6ed25778..2754d011 100644 --- a/.github/workflows/kotlin-multiplatform.yml +++ b/.github/workflows/kotlin-multiplatform.yml @@ -113,30 +113,3 @@ jobs: - name: Test samples run: | ./gradlew allTests -p sentry-samples - - archive-distribution: - runs-on: macos-latest-xlarge - - steps: - - uses: actions/checkout@v4 - - - name: JDK setup - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - - name: Cached Gradle - uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a - - - name: DistZip - run: | - ./scripts/build-distribution.sh sentry-kotlin-multiplatform - - - name: Archive packages - uses: actions/upload-artifact@v4 - with: - name: ${{ github.sha }} - if-no-files-found: error - path: | - ./*/build/distributions/*.zip diff --git a/.github/workflows/upload-artifacts.yml b/.github/workflows/upload-artifacts.yml new file mode 100644 index 00000000..8cf701d1 --- /dev/null +++ b/.github/workflows/upload-artifacts.yml @@ -0,0 +1,42 @@ +name: "Generate and upload distributions" +on: + push: + branches: + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + archive-distribution: + runs-on: macos-latest-xlarge + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Cached Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a + + - name: DistZip libraries + run: | + ./gradlew distZip + + - name: DistZip plugin + run: | + cd sentry-kotlin-multiplatform-gradle-plugin + ./gradlew distZip sentryPluginMarkerDistZip + + - name: Archive packages + uses: actions/upload-artifact@v4 + with: + name: ${{ github.sha }} + if-no-files-found: error + path: | + ./*/build/distributions/*.zip diff --git a/sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts b/sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts index 6789a439..f457018c 100644 --- a/sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts +++ b/sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts @@ -40,7 +40,7 @@ tasks.withType { kotlinOptions { jvmTarget = JavaVersion.VERSION_ gradlePlugin { plugins { - create(property("id").toString()) { + register("sentryPlugin") { id = property("id").toString() implementationClass = property("implementationClass").toString() } @@ -52,32 +52,39 @@ val publish = extensions.getByType(MavenPublishPluginExtension::class.java) // via gpg:sign-and-deploy-file (release.kts) publish.releaseSigningEnabled = false -tasks.named("distZip").configure { +tasks.named("distZip") { dependsOn("publishToMavenLocal") - this.doLast { - val distributionFilePath = - "${project.layout.buildDirectory.asFile.get().path}${sep}distributions${sep}${project.name}-${project.version}.zip" - val file = File(distributionFilePath) - if (!file.exists()) { - throw IllegalStateException("Distribution file: $distributionFilePath does not exist") - } - if (file.length() == 0L) { - throw IllegalStateException("Distribution file: $distributionFilePath is empty") + onlyIf { + inputs.sourceFiles.isEmpty.not().also { + require(it) { "No distribution to zip." } } } } -val sep = File.separator +val sep: String = File.separator distributions { main { contents { from("build${sep}libs") - from("build${sep}publications${sep}maven") + from("build${sep}publications${sep}pluginMaven") + } + } + create("sentryPluginMarker") { + contents { + from("build${sep}publications${sep}sentryPluginPluginMarkerMaven") } } } +tasks.named("sentryPluginMarkerDistTar") { + mustRunAfter("generatePomFileForSentryPluginPluginMarkerMavenPublication") +} + +tasks.named("sentryPluginMarkerDistZip") { + mustRunAfter("generatePomFileForSentryPluginPluginMarkerMavenPublication") +} + buildConfig { useKotlinOutput() packageName("io.sentry") diff --git a/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties b/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties index 73eb14b5..800c6051 100644 --- a/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties +++ b/sentry-kotlin-multiplatform-gradle-plugin/gradle.properties @@ -4,3 +4,18 @@ versionName=0.7.1 group=io.sentry # TODO: Update update-cocoa.sh so the cocoa version is auto updated as well sentryCocoaVersion=8.26.0 + +# publication pom properties +POM_NAME=Sentry Kotlin Multiplatform Gradle Plugin +POM_DESCRIPTION=Sentry Kotlin Multiplatform Gradle Plugin +POM_URL=https://github.com/getsentry/sentry-kotlin-multiplatform +POM_SCM_URL=https://github.com/getsentry/sentry-kotlin-multiplatform +POM_SCM_CONNECTION=scm:git:git://github.com/getsentry/sentry-kotlin-multiplatform.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/getsentry/sentry-kotlin-multiplatform.git + +POM_LICENCE_NAME=MIT +POM_LICENCE_URL=https://github.com/getsentry/sentry-kotlin-multiplatform/blob/main/LICENSE + +POM_DEVELOPER_ID=getsentry +POM_DEVELOPER_NAME=Sentry Team and Contributors +POM_DEVELOPER_URL=https://github.com/getsentry/ \ No newline at end of file