Skip to content

Commit

Permalink
test for rel v2.0.0-0.9.0-dev1
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Jun 25, 2024
1 parent e94a78d commit 84b0cbd
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 102 deletions.
5 changes: 5 additions & 0 deletions .changelog/v2.0.0-0.9.0-dev1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Kotlin version: `v2.0.0`

> [!warning]
> This is a version to test the CI configuration used for the release version,
and the content is no different from `0.9.0`.
64 changes: 33 additions & 31 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,78 @@ env:
GRADLE_OPTS: "-Dfile.encoding=UTF-8"

jobs:
test-build-publish:
name: Test and build
# runs-on: ubuntu-latest
test:
name: Test
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
- run: gradle assemble build allTests -s

publish:
name: Publish
needs: test
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
# Setup java
# https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java 11
uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Test and publish to sonatype
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
assemble
build
allTests
arguments:
publishToSonatype
closeAndReleaseStagingRepository
--info
-s
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
env:
PLUGIN_AUTO: ${{ matrix.os == 'ubuntu-latest' }}
PLUGIN_AUTO: true

publish-gradle-plugin:
name: Publish Gradle Plugin
runs-on: ubuntu-latest
needs: test-build-publish
needs: publish
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Setup java
# https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Publish to gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
build
publishPlugins
--info
-s
--warning-mode all
-x test
--build-cache
Expand All @@ -96,32 +104,26 @@ jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
needs: [ test-build-publish, publish-gradle-plugin ]
needs: [ publish, publish-gradle-plugin ]
permissions:
contents: write
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v3

# Setup java
# https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Create changelog
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: createChangelog

# https://github.com/softprops/action-gh-release
# Create gitHub release
- name: Create Github Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.FORTE_TOKEN }}
draft: true
Expand Down
15 changes: 10 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import love.forte.gradle.common.core.project.setup
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

buildscript {
extra["kotlin_plugin_id"] = "love.forte.plugin.suspend-transform"
}

setup(IProject)
val ktVersion = libs.versions.kotlin.get()

group = IProject.GROUP
description = IProject.DESCRIPTION
version = ktVersion + "-" + IProject.pluginVersion.toString()

allprojects {
setup(IProject)
group = IProject.GROUP
description = IProject.DESCRIPTION
version = ktVersion + "-" + IProject.pluginVersion.toString()

repositories {
mavenCentral()
Expand Down Expand Up @@ -36,13 +41,13 @@ apply(plugin = "suspend-transform.nexus-publish")
tasks.create("createChangelog") {
group = "documentation"
doFirst {
val tag = "v${IProject.version}"
val tag = "v$ktVersion-${IProject.pluginVersion}"
val changelogDir = rootProject.file(".changelog").apply { mkdirs() }
with(File(changelogDir, "$tag.md")) {
if (!exists()) {
createNewFile()
}
writeText("Kotlin version: `v${libs.versions.kotlin.get()}`")
writeText("Kotlin version: `v$ktVersion`")
}
}
}
14 changes: 13 additions & 1 deletion buildSrc/src/main/kotlin/IProject.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import love.forte.gradle.common.core.project.ProjectDetail
import love.forte.gradle.common.core.project.Version
import love.forte.gradle.common.core.project.minus
import love.forte.gradle.common.core.project.version
import org.gradle.api.Project

object IProject : ProjectDetail() {

const val GROUP = "love.forte.plugin.suspend-transform"
const val DESCRIPTION = "Generate platform-compatible functions for Kotlin suspend functions"
const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin"

override val version: Version = version(0, 9, 0)
// TODO
val ktVersion = version(2, 0, 0)
val pluginVersion = version(0, 9, 0) - version("dev1")

override val version: Version = ktVersion - pluginVersion

override val homepage: String get() = HOMEPAGE

Expand Down Expand Up @@ -37,3 +43,9 @@ object IProject : ProjectDetail() {
}

}

fun Project.setupWith(ktVersion: String) {
group = IProject.GROUP
description = IProject.DESCRIPTION
version = ktVersion + "-" + IProject.pluginVersion.toString()
}
13 changes: 0 additions & 13 deletions buildSrc/src/main/kotlin/MultiplatformTargetsConfigure.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tasks.named("dokkaHtmlPartial").configure {

tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
version = IProject.version
version = project.version
documentedVisibilities.set(
listOf(
DokkaConfiguration.Visibility.PUBLIC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import love.forte.gradle.common.core.Gpg
import love.forte.gradle.common.core.project.setup
import love.forte.gradle.common.publication.configure.jvmConfigPublishing
import love.forte.gradle.common.publication.configure.configPublishMaven
import love.forte.gradle.common.publication.configure.publishingExtension
import love.forte.gradle.common.publication.configure.setupPom
import love.forte.gradle.common.publication.configure.signingExtension
import utils.isMainPublishable

plugins {
id("signing")
id("maven-publish")
}

setup(IProject)
//setup(IProject)

//val (sonatypeUsername, sonatypePassword) = sonatypeUserInfoOrNull

Expand All @@ -21,34 +22,71 @@ val gpgValue = Gpg.ofSystemPropOrNull()
val p = project

if (isMainPublishable()) {
jvmConfigPublishing {
project = IProject
isSnapshot = project.version.toString().contains("SNAPSHOT", true)

val isSnapshot = project.version.toString().contains("SNAPSHOT")
publishingExtension {
repositories {
mavenLocal()
if (isSnapshot) {
configPublishMaven(SnapshotRepository)
} else {
configPublishMaven(ReleaseRepository)
}
}
val jarSources = tasks.register("${p.name}SourceJar", Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}

val jarJavadoc = tasks.register("${p.name}JavadocJar", Jar::class) {
// dependsOn(tasks.dokkaHtml)
// from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

tasks.withType<GenerateModuleMetadata> {
dependsOn(jarSources)
dependsOn(jarJavadoc)
publications {
create<MavenPublication>("publicationDist") {
from(components.getByName("java"))
artifact(jarSources)
artifact(jarJavadoc)
version = p.version.toString()
setupPom(p.name, IProject)
}
}

artifact(jarSources)
artifact(jarJavadoc)
signingExtension {
val gpg = gpgValue ?: return@signingExtension

releasesRepository = ReleaseRepository
snapshotRepository = SnapshotRepository

gpg = gpgValue
val (keyId, secretKey, password) = gpg
useInMemoryPgpKeys(keyId, secretKey, password)
sign(publishingExtension.publications)
}
}
// jvmConfigPublishing {
// project = IProject
// isSnapshot = project.version.toString().contains("SNAPSHOT", true)
//
// val jarSources = tasks.register("${p.name}SourceJar", Jar::class) {
// archiveClassifier.set("sources")
// from(sourceSets["main"].allSource)
// }
//
// val jarJavadoc = tasks.register("${p.name}JavadocJar", Jar::class) {
//// dependsOn(tasks.dokkaHtml)
//// from(tasks.dokkaHtml.flatMap { it.outputDirectory })
// archiveClassifier.set("javadoc")
// }
//
// tasks.withType<GenerateModuleMetadata> {
// dependsOn(jarSources)
// dependsOn(jarJavadoc)
// }
//
// artifact(jarSources)
// artifact(jarJavadoc)
//
// releasesRepository = ReleaseRepository
// snapshotRepository = SnapshotRepository
//
// gpg = gpgValue
// }

}

Expand Down
Loading

0 comments on commit 84b0cbd

Please sign in to comment.