diff --git a/README.md b/README.md index b850f3f..2fd2bab 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,11 @@ information on how to get started. And thank you for your interest in this project! ## License -This project is provided under the [MIT license](LICENSE). \ No newline at end of file +This project is provided under the [MIT license](LICENSE). +## Maven + +```kotlin +implementation("computer.kolektiv.kraft:kraft:") +``` + +GroupId: `computer.kolektiv.kraft` (Kotlin packages still `sh.illumi.kraft.*` until a follow-up). Dual-publish: see `docs/CI_DUAL_PUBLISH.md`. diff --git a/build.gradle.kts b/build.gradle.kts index 8bbc440..6e54e65 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { alias(libs.plugins.vanniktech.mavenPublish) apply false } -group = "sh.illumi.kraft" +group = "computer.kolektiv.kraft" version = "0.0.2" allprojects { @@ -22,3 +22,5 @@ allprojects { google() } } + +apply(from = "gradle/gh-packages.gradle.kts") diff --git a/docs/CI_DUAL_PUBLISH.md b/docs/CI_DUAL_PUBLISH.md new file mode 100644 index 0000000..a78d1ce --- /dev/null +++ b/docs/CI_DUAL_PUBLISH.md @@ -0,0 +1,54 @@ +# Dual-publish (GH Packages + Yuri + JSR) + +Org epic: [KolektivComputer/.github#2](https://github.com/KolektivComputer/.github/issues/2) +Spine: [gradle-conventions#1](https://github.com/KolektivComputer/gradle-conventions/pull/1) → plugin `computer.kolektiv.publishing` + +## Maven +- GroupId: `computer.kolektiv.kraft` (org family `computer.kolektiv.*`) +- Dual repositories: GitHub Packages `https://maven.pkg.github.com/KolektivComputer/kraft` **and** Yuri Capital (`maven-releases` / `maven-snapshots`) when credentials are present +- Prefer `id("computer.kolektiv.publishing")` once the conventions plugin is published; until then repos are inlined to match that plugin + +## npm +- Scope **`@kolektiv/...` only** — do not invent a second JS scope +- Dual: existing Yuri Capital npm (where used) + `https://npm.pkg.github.com` with `@kolektiv:registry=…` +- Auth: `NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}` with `permissions.packages: write` + +## JSR +- Scope `@kolektiv` (owned) +- Actions: OIDC only — `permissions.id-token: write` — **no org `JSR_TOKEN`** +- Mey: link each package on jsr.io for GitHub Actions trusted publishing +- Not a substitute for npm publish + +## Workflow paste (token may lack `workflows` scope) + +```yaml +permissions: + contents: read + packages: write + id-token: write # JSR OIDC +``` + +Maven job env: +```yaml +GITHUB_ACTOR: ${{ github.actor }} +GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# optional Yuri dual: +# YURI_CAPITAL_REPO_USERNAME / YURI_CAPITAL_REPO_PASSWORD (org secrets) +``` + +npm → GitHub Packages: +```yaml +- uses: actions/setup-node@v4 + with: + registry-url: https://npm.pkg.github.com + scope: "@kolektiv" +env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +JSR: +```yaml +- run: npx jsr publish +``` + +Kotlin source packages remain `sh.illumi.kraft.*` until a follow-up rename; Maven group is `computer.kolektiv.kraft`. diff --git a/gradle/gh-packages.gradle.kts b/gradle/gh-packages.gradle.kts new file mode 100644 index 0000000..3a272ec --- /dev/null +++ b/gradle/gh-packages.gradle.kts @@ -0,0 +1,42 @@ +import org.gradle.api.publish.PublishingExtension + +/** + * Dual-publish repos matching computer.kolektiv.publishing + * (gradle-conventions#1). Inline until the plugin is published. + */ +subprojects { + pluginManager.withPlugin("maven-publish") { + extensions.configure("publishing") { + repositories { + val ghActor = providers.environmentVariable("GITHUB_ACTOR") + val ghToken = providers.environmentVariable("GITHUB_TOKEN") + if (ghActor.isPresent && ghToken.isPresent) { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/KolektivComputer/kraft") + credentials { + username = ghActor.get() + password = ghToken.get() + } + } + } + val yuriUser = providers.environmentVariable("YURI_CAPITAL_REPO_USERNAME") + val yuriPass = providers.environmentVariable("YURI_CAPITAL_REPO_PASSWORD") + if (yuriUser.isPresent && yuriPass.isPresent) { + val snapshot = version.toString().endsWith("-SNAPSHOT", ignoreCase = true) + maven { + name = if (snapshot) "yuriSnapshots" else "yuriReleases" + url = uri( + if (snapshot) "https://repo.yuri.capital/repository/maven-snapshots/" + else "https://repo.yuri.capital/repository/maven-releases/" + ) + credentials { + username = yuriUser.get() + password = yuriPass.get() + } + } + } + } + } + } +}