Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
outputs:
last_sha: "${{ fromJson(steps.check-last-run.outputs.data).workflow_runs[0].head_sha }}"

publish-snapshot:
publish-maven-snapshot:
needs: ["check-last-run"]
if: "${{ needs.check-last-run.outputs.last_sha != github.sha }}"
runs-on: "macos-latest"
Expand All @@ -30,11 +30,26 @@ jobs:
with:
fetch-depth: 0
- uses: "./.github/actions/setup"
- run: "./gradlew publishAllPublicationsToGitHubPackagesRepository"
- run: "./gradlew :publishAllPublicationsToGitHubPackagesRepository"
env:
ORG_GRADLE_PROJECT_GitHubPackagesPassword: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_GitHubPackagesUsername: "${{ github.actor }}"

publish-npm-snapshot:
needs: ["check-last-run"]
if: "${{ needs.check-last-run.outputs.last_sha != github.sha }}"
runs-on: "macos-latest"
permissions:
packages: "write"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- uses: "./.github/actions/setup"
- run: "./gradlew :publishJsPackageToNpmjsRegistry"
env:
NPM_PUBLISH_REGISTRY_GITHUB_AUTHTOKEN: "${{ secrets.GITHUB_TOKEN }}"

dependency-submission:
needs: ["check-last-run"]
if: "${{ needs.check-last-run.outputs.last_sha != github.sha }}"
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,28 @@ jobs:
fetch-depth: 0
- run: "git fetch --tags --force" # https://github.com/actions/checkout/issues/290
- uses: "./.github/actions/setup"
- run: "./gradlew publishAndReleaseToMavenCentral --no-configuration-cache"
- run: "./gradlew :publishAndReleaseToMavenCentral --no-configuration-cache"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: "${{ secrets.MAVEN_CENTRAL_USERNAME }}"
ORG_GRADLE_PROJECT_mavenCentralPassword: "${{ secrets.MAVEN_CENTRAL_PASSWORD }}"
ORG_GRADLE_PROJECT_signingInMemoryKey: "${{ secrets.GPG_PRIVATE_KEY }}"
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: "${{ secrets.GPG_PASSPHRASE }}"

publish-npm:
runs-on: macos-latest
environment:
name: "npm"
url: "https://www.npmjs.com/package/pokekotlin"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- run: "git fetch --tags --force" # https://github.com/actions/checkout/issues/290
- uses: "./.github/actions/setup"
- run: "./gradlew :publishJsPackageToNpmjsRegistry"
env:
NPM_PUBLISH_REGISTRY_NPMJS_AUTHTOKEN: "${{ secrets.NPM_ACCESS_TOKEN }}"

publish-pages:
needs:
- "publish-maven"
Expand All @@ -40,7 +55,7 @@ jobs:
fetch-depth: 0
- run: "git fetch --tags --force" # https://github.com/actions/checkout/issues/290
- uses: "./.github/actions/setup"
- run: "./gradlew generateDocs"
- run: "./gradlew :generateDocs"
- uses: "actions/upload-pages-artifact@v3"
with:
path: "build/docs"
Expand Down
11 changes: 11 additions & 0 deletions README.npm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PokeKotlin

Maintainer: [@sargunv](https://github.com/sargunv)

PokeKotlin is an async, `Promise` based client for [PokéAPI] written in [Kotlin
Multiplatform]. It supports browser and Node environments. For usage details,
see the [documentation].

[Kotlin Multiplatform]: https://kotlinlang.org/docs/multiplatform.html
[PokéAPI]: https://pokeapi.co/
[documentation]: https://pokeapi.github.io/pokekotlin/
30 changes: 29 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
alias(libs.plugins.jgitver)
alias(libs.plugins.suspendTransformCompiler)
alias(libs.plugins.kover)
alias(libs.plugins.npmPublish)
id("maven-publish")
}

Expand Down Expand Up @@ -142,6 +143,33 @@ tasks.withType<KotlinNativeSimulatorTest> {
(project.findProperty("appleNativeSimulatorDevice") as? String)?.let { device.set(it) }
}

npmPublish {
readme = project.file("README.npm.md")
packages {
named("js") {
packageJson {
description = "Promise based client for PokéAPI written in Kotlin"
keywords = setOf("pokeapi", "pokemon", "api", "kotlin")
homepage = "https://pokeapi.github.io/pokekotlin/"
license = "Apache-2.0"
author {
name = "Sargun Vohra"
url = "https://github.com/sargunv"
}
bugs { url = "https://github.com/PokeAPI/pokekotlin/issues" }
repository {
type = "git"
url = "git+https://github.com/PokeAPI/pokekotlin.git"
}
}
}
}
registries {
npmjs {}
github {}
}
}

publishing {
repositories {
maven {
Expand All @@ -158,7 +186,7 @@ mavenPublishing {
pom {
name = "PokeKotlin"
description = "Kotlin client for The Pokémon API"
url = "https://github.com/PokeAPI/pokekotlin"
url = "https://pokeapi.github.io/pokekotlin/"
licenses {
license {
name.set("The Apache License, Version 2.0")
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gradle-mavenPublish = "0.33.0"
gradle-mkdocs = "4.0.1"
gradle-spotless = "7.0.4"
gradle-kover = "0.9.1"
gradle-npm-publish = "3.5.3"
tool-prettier = "3.6.2"

# Don't forget to check settings.gradle for more versions
Expand Down Expand Up @@ -64,3 +65,4 @@ mkdocs = { id = "ru.vyarus.mkdocs-build", version.ref = "gradle-mkdocs" }
spotless = { id = "com.diffplug.spotless", version.ref = "gradle-spotless" }
suspendTransformCompiler = { id = "love.forte.plugin.suspend-transform", version.ref = "gradle-suspendTransformCompiler" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "gradle-kover" }
npmPublish = { id = "dev.petuska.npm.publish", version.ref = "gradle-npm-publish" }
Loading