Skip to content

Commit

Permalink
升级版本号 0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ssttkkl committed Dec 13, 2023
1 parent fdc1789 commit 5df5e3e
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-entry-fatjar.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build WebApi FatJar
on:
push:
release:
types: [published]
workflow_dispatch:

jobs:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/dokka-gfm.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build DokkaGfm Documents

on:
push:
pull_request:
branches: [main]
workflow_dispatch:

jobs:
Expand Down
73 changes: 42 additions & 31 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,72 @@ name: Publish KMP with Gradle

on:
release:
types: [created]
types: [published]

jobs:
build:
publish:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]

runs-on: macos-latest
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write

env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: secret_ring.gpg

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11

- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
distribution: temurin
java-version: 17
cache: 'gradle'

- name: Cache Kotlin/Native compiler
id: cache-konan
uses: actions/cache@v3
with:
path: ~/.konan
key: ${{ runner.os }}-konan

- uses: actions/setup-node@v4
- name: Set up Node.js 22-v8-canary
name: Set up Node.js
with:
node-version: '22-v8-canary'
node-version: '21-v8-canary'
registry-url: 'https://registry.npmjs.org'

- name: Decode secret_ring.gpg
env:
SIGNING_SECRET_KEY_RING_BASE64: ${{ secrets.SIGNING_SECRET_KEY_RING_BASE64 }}
run: |
echo $SIGNING_SECRET_KEY_RING_BASE64 | base64 --decode > secret_ring.gpg
- name: Write local.properties
uses: christian-draeger/[email protected]
with:
path: local.properties
# The property keys you want to write. Accepts an array.
property: |
'ossrhUsername'
'ossrhPassword'
'signing.keyId'
'signing.password'
'signing.secretKeyRingFile'
# The property values you want to write (same order as the keys). Accepts an array.
value: |
${{ secrets.OSSRH_USERNAME }}
${{ secrets.OSSRH_PASSWORD }}
${{ secrets.SIGNING_KEYID }}
${{ secrets.SIGNING_PASSWORD }}
'secret_ring.gpg'
echo $SIGNING_SECRET_KEY_RING_BASE64 | base64 --decode > $SIGNING_SECRET_KEY_RING_FILE
- name: Publish mahjong-utils
if: ${{ matrix.os == 'macos-latest' }}
run: |
./gradlew :mahjong-utils:publishAllPublicationsToSonatypeRepository
- name: Publish mahjong-utils (linuxX64 only)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
./gradlew :mahjong-utils:publishLinuxX64PublicationToSonatypeRepository
- name: Publish mahjong-utils (mingwX64 only)
if: ${{ matrix.os == 'windows-latest' }}
run: |
./gradlew :mahjong-utils:publish
./gradlew :mahjong-utils:publishMingwX64PublicationToSonatypeRepository
- name: Publish mahjong-utils-entry for JS/WASM
if: ${{ matrix.os == 'macos-latest' }}
run: |
./gradlew :mahjong-utils-entry:publishJsPackageToNpmjsRegistry
./gradlew :mahjong-utils-entry:publishWasmJsPackageToNpmjsRegistry
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/kover-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ jobs:
java-version: 17
cache: 'gradle'

- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Cache Kotlin/Native compiler
id: cache-konan
uses: actions/cache@v3
with:
path: ~/.konan
key: ${{ runner.os }}-konan

- name: Generate Kover Report
run: ./gradlew koverXmlReport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class KmpLibConventionPlugin : Plugin<Project> {
}

configure<KotlinMultiplatformExtension> {
applyDefaultHierarchyTemplate()
jvmToolchain(11)

jvm {
Expand Down Expand Up @@ -47,21 +48,21 @@ class KmpLibConventionPlugin : Plugin<Project> {
when {
hostOs == "Mac OS X" -> {
if (isAarch64) {
macosArm64("native")
macosArm64()
} else {
macosX64("native")
macosX64()
}
}

hostOs == "Linux" -> {
if (isAarch64) {
linuxArm64("native")
linuxArm64()
} else {
linuxX64("native")
linuxX64()
}
}

isMingwX64 -> mingwX64("native")
isMingwX64 -> mingwX64()
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ class MavenPublishConventionPlugin : Plugin<Project> {
extra["gprToken"] = System.getenv("GPR_TOKEN")
}

val secretKeyRingFile = Path(extra["signing.secretKeyRingFile"].toString())
extra["signing.secretKeyRingFile"] = rootProject.file(secretKeyRingFile)
val secretKeyRingFile = extra["signing.secretKeyRingFile"]?.toString()?.let {
rootProject.file(it)
}?.also {
extra["signing.secretKeyRingFile"] = it.absoluteFile
}

val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
Expand Down Expand Up @@ -114,7 +117,7 @@ class MavenPublishConventionPlugin : Plugin<Project> {
}
}

if (secretKeyRingFile.exists()) {
if (secretKeyRingFile?.exists() == true) {
// Signing artifacts. Signing.* extra properties values will be used
extensions.configure<SigningExtension> {
sign(extensions.getByType<PublishingExtension>().publications)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tasks.wrapper {

rootProject.plugins.withType<NodeJsRootPlugin> {
rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary20231024d0ddc81258"
nodeVersion = "21.0.0-v8-canary20231019bd785be450"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

group=io.github.ssttkkl
version=0.6.0
version=0.6.1

org.gradle.jvmargs=-Xmx8g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.9.20"
kotlin = "1.9.21"
kotlinx-coroutines = "1.8.0-RC"
kotlinx-serialization = "1.6.2"
ktor = "2.3.6"
Expand All @@ -21,7 +21,7 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" }
devPetsuka-npmPublish = { id = "dev.petuska.npm.publish", version = "3.2.0" }
devPetsuka-npmPublish = { id = "dev.petuska.npm.publish", version = "3.4.1" }
jetbrains-dokka = { id = "org.jetbrains.dokka", version = "1.9.10" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }

Expand Down
38 changes: 26 additions & 12 deletions mahjong-utils-entry/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ kotlin {
binaries.library()
useCommonJs()
}
compilations["main"].packageJson {
name = "mahjong-utils-entry"
customField(
"author", mapOf(
"name" to "ssttkkl",
"email" to "[email protected]"
)
)
customField(
"license", "MIT"
)
}
}
wasmJs {
browser {
Expand All @@ -53,6 +41,10 @@ kotlin {
}
}

afterEvaluate {
tasks.getByName("assembleWasmJsPackage").dependsOn("compileProductionLibraryKotlinWasmJsOptimize")
}

val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = targets.filterIsInstance<KotlinNativeTargetWithHostTests>().firstOrNull()
Expand Down Expand Up @@ -98,6 +90,28 @@ kotlin {
}

npmPublish {
packages {
get("js").apply {
packageJson {
name = "mahjong-utils-entry"
author {
name = "ssttkkl"
email = "[email protected]"
}
license = "MIT"
}
}
get("wasmJs").apply {
packageJson {
name = "mahjong-utils-entry-wasm"
author {
name = "ssttkkl"
email = "[email protected]"
}
license = "MIT"
}
}
}
registries {
register("npmjs") {
uri.set("https://registry.npmjs.org")
Expand Down

0 comments on commit 5df5e3e

Please sign in to comment.