Kantis / ks3

KotlinX Serialization Standard Serializers (KS3)
Apache License 2.0
19 stars 4 forks source link

Publish snapshots on main builds #17

Closed Kantis closed 1 year ago

Kantis commented 1 year ago

Github CI workflow needs to be tweaked to conditionally publish snapshots if built from main

aSemy commented 1 year ago

Here's a sketch of a plan

Then snapshot releasing is automatic, and manual releasing means creating a tag.

Kantis commented 1 year ago

@aSemy I think semver calculations, signing keys, etc are working but there's some issue with the gradle setup. Do you have time to have a look?

aSemy commented 1 year ago

Ahh the wonders of Gradle. I'll take a look now.

aSemy commented 1 year ago

so the tests still work, but publishing does not

build scan of the failing linux jvm publish task https://scans.gradle.com/s/73dqhlc2nhi4s

aSemy commented 1 year ago

@Kantis Are you able to run ./gradlew publishAllPublicationsToMavenProjectLocalRepository locally, with the appropriate signing properties set?

Kantis commented 1 year ago

Yup.


> Task :ks3-jdk:publishJsPublicationToMavenProjectLocalRepository
[task: :ks3-jdk:publishJsPublicationToMavenProjectLocalRepository] io.ks3:ks3-jdk-js:0.0.1-SNAPSHOT

> Task :ks3-standard:publishJsPublicationToMavenProjectLocalRepository
[task: :ks3-standard:publishJsPublicationToMavenProjectLocalRepository] io.ks3:ks3-standard-js:0.0.1-SNAPSHOT

> Task :ks3-standard:publishJvmPublicationToMavenProjectLocalRepository
[task: :ks3-standard:publishJvmPublicationToMavenProjectLocalRepository] io.ks3:ks3-standard-jvm:0.0.1-SNAPSHOT

> Task :ks3-jdk:publishJvmPublicationToMavenProjectLocalRepository
[task: :ks3-jdk:publishJvmPublicationToMavenProjectLocalRepository] io.ks3:ks3-jdk-jvm:0.0.1-SNAPSHOT

> Task :ks3-standard:publishKotlinMultiplatformPublicationToMavenProjectLocalRepository
[task: :ks3-standard:publishKotlinMultiplatformPublicationToMavenProjectLocalRepository] io.ks3:ks3-standard:0.0.1-SNAPSHOT

> Task :ks3-jdk:publishKotlinMultiplatformPublicationToMavenProjectLocalRepository
[task: :ks3-jdk:publishKotlinMultiplatformPublicationToMavenProjectLocalRepository] io.ks3:ks3-jdk:0.0.1-SNAPSHOT
aSemy commented 1 year ago

Possible related to the secrets not being available https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#accessing-secrets

Also I changed the Gradle property for the Sonatype user/pass to just come from a Gradle property, so they need to be set using ORG_PROGJEC_GRADLE_osshrUsername

aSemy commented 1 year ago

Publishing main branch snapshots is working now, but only for JVM

https://s01.oss.sonatype.org/content/repositories/snapshots/io/ks3/ks3-standard-jvm/main-SNAPSHOT/

Kantis commented 1 year ago

ok, but I would like it to work like with the GHA I added.. Snapshot should be called next-ver-SNAPSHOT, where next-ver is latest tagged version + major if there's a commit with(MAJOR) since that release, or minor if there's a (MINOR) commit, otherwise a patch version bump.

Kantis commented 1 year ago

Thought I guess the current setup helps when testing different feature-branches.. 🤔 Still, I think the Major/Minor thing is nice.

aSemy commented 1 year ago

Oh sorry, I didn't realise the GHA you added was doing that. I thought it was just extracting the most recent tag version.

Some amount of logic is possible with the git-versioning plugin, but maybe not to that extent...

It is possible to tell it to fetch the previous git tag on the branch, and suffix that with -SNAPSHOT.

aSemy commented 1 year ago

I think it published main-SNAPSHOT because there's no tag. If there's a tag, e.g. v0.0.1, then the published version would be 0.0.1-SNAPSHOT

Kantis commented 1 year ago

I guess we could put 0.0.1 out to have something to start calculating from.. Would also let us try the release process :)

Kantis commented 1 year ago

Looks like main-SNAPSHOT went out even when latest commit was tagged :/

aSemy commented 1 year ago

Maybe this fixes that https://github.com/Kantis/ks3/commit/58e1f191d37755486b2353b7428c55dfc042544a

aSemy commented 1 year ago

Hmm, no luck https://github.com/Kantis/ks3/actions/runs/3324493107/jobs/5496116866#step:6:929

Kantis commented 1 year ago

Got a couple of failures now on Sonatype

typeId | sources-staging
-- | --
failureMessage | Missing: no main jar artifact found in folder '/io/ks3/ks3-standard-jvm/0.0.1'

typeId | javadoc-staging
-- | --
failureMessage | Missing: no main jar artifact found in folder '/io/ks3/ks3-standard-jvm/0.0.1'

typeId | signature-staging
-- | --
failureMessage | Missing Signature: '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1.jar.asc' does not exist for 'ks3-jdk-0.0.1.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1-kotlin-tooling-metadata.json.asc'  does not exist for 'ks3-jdk-0.0.1-kotlin-tooling-metadata.json'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1.module.asc' does not exist for 'ks3-jdk-0.0.1.module'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1-sources.jar.asc' does not exist for 'ks3-jdk-0.0.1-sources.jar'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1.pom.asc' does not exist for 'ks3-jdk-0.0.1.pom'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk/0.0.1/ks3-jdk-0.0.1-javadoc.jar.asc' does not exist for 'ks3-jdk-0.0.1-javadoc.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1-sources.jar.asc' does not  exist for 'ks3-standard-0.0.1-sources.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1-kotlin-tooling-metadata.json.asc'  does not exist for 'ks3-standard-0.0.1-kotlin-tooling-metadata.json'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1-javadoc.jar.asc' does not  exist for 'ks3-standard-0.0.1-javadoc.jar'.
failureMessage | Missing Signature: '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1.pom.asc' does not exist for 'ks3-standard-0.0.1.pom'.
failureMessage | Missing Signature: '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1.module.asc' does not exist for 'ks3-standard-0.0.1.module'.
failureMessage | Missing Signature: '/io/ks3/ks3-standard/0.0.1/ks3-standard-0.0.1.jar.asc' does not exist for 'ks3-standard-0.0.1.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-jdk-jvm/0.0.1/ks3-jdk-jvm-0.0.1-javadoc.jar.asc' does not  exist for 'ks3-jdk-jvm-0.0.1-javadoc.jar'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk-jvm/0.0.1/ks3-jdk-jvm-0.0.1.module.asc' does not exist for 'ks3-jdk-jvm-0.0.1.module'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk-jvm/0.0.1/ks3-jdk-jvm-0.0.1.pom.asc' does not exist for 'ks3-jdk-jvm-0.0.1.pom'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-jdk-jvm/0.0.1/ks3-jdk-jvm-0.0.1-sources.jar.asc' does not  exist for 'ks3-jdk-jvm-0.0.1-sources.jar'.
failureMessage | Missing Signature: '/io/ks3/ks3-jdk-jvm/0.0.1/ks3-jdk-jvm-0.0.1.jar.asc' does not exist for 'ks3-jdk-jvm-0.0.1.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard-jvm/0.0.1/ks3-standard-jvm-0.0.1.module.asc' does  not exist for 'ks3-standard-jvm-0.0.1.module'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard-jvm/0.0.1/ks3-standard-jvm-0.0.1.pom.asc' does not  exist for 'ks3-standard-jvm-0.0.1.pom'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard-jvm/0.0.1/ks3-standard-jvm-0.0.1-sources.jar.asc'  does not exist for 'ks3-standard-jvm-0.0.1-sources.jar'.
failureMessage | Missing  Signature:  '/io/ks3/ks3-standard-jvm/0.0.1/ks3-standard-jvm-0.0.1-javadoc.jar.asc'  does not exist for 'ks3-standard-jvm-0.0.1-javadoc.jar'.
Kantis commented 1 year ago

Arrow has a lot of stuff for publishing multiplatform things, if we need more sources of inspiration. https://github.com/arrow-kt/arrow-gradle-config/tree/main/arrow-gradle-config-publish/src/main/kotlin/internal

aSemy commented 1 year ago

I've asked if it's possible here https://github.com/qoomon/gradle-git-versioning-plugin/issues/104

aSemy commented 1 year ago

Got a couple of failures now on Sonatype

this might be because Sonatype doesn't like parallel uploads - I've disabled it for now. But it could be because the Gradle signing plugin is really old and doesn't work properly.

Kantis commented 1 year ago

It looks like there's no signing tasks registered when the publishing is configured. This breakpoint is never hit.

image
aSemy commented 1 year ago

I'll just get ks3 set up on my machine that has the signing credentials, and I'll test the signing locally to see what's up.

With regards to the automatic versioning, the git-versioning-plugin doesn't work how I expect, and I don't think it's possible to tag a commit (e.g. v1.2.3), and then make another commit which will have a version of 1.2.4-SNAPSHOT - it will always be main-SNAPSHOT (or 1.2.3-SNAPSHOT, but that doesn't really make sense). Maybe it's best to restore the GitHub Action that I removed. I'm not sure.

Kantis commented 1 year ago

Nice, thanks.

I've also been thinking that the GHA might be the simplest way forward, but wanted to give you some space to experiment. It's definitely not urgent, but would be nice to get proper snapshot names at some point

Kantis commented 1 year ago

Snapshots also dont seem to contain anything except sources and javadoc..? 🤔

image
aSemy commented 1 year ago

I think that Sonatype just doesn't show jars...? At least in SNAPSHOT releases. It's really weird. It's also not showing the .asc signature files.

The jars are there though https://s01.oss.sonatype.org/content/repositories/snapshots/io/ks3/ks3-jdk-jvm/main-SNAPSHOT/

image

It's the same for some of the Kotest snapshot dependencies too? I'm very confused https://s01.oss.sonatype.org/#nexus-search;gav~io.kotest~kotest-framework-datatest-jvm~~~~kw,versionexpand

image

Kantis commented 1 year ago

This is working now, not sure what made the difference in the end.. Lazy evaluation in general is great, but figuring out why things aren't applied correctly is a nightmare. We might have some cleanup to do in build-logic, but I'll close this issue.