Repository navigation
ci(kotlin): publish on the push of a release commit to main - #1745
Draft
mattcreaser wants to merge 1 commit into
Draft
mattcreaser wants to merge 1 commit into
mattcreaser wants to merge 1 commit into
Conversation
A pull_request run deploys from refs/pull/<n>/merge. That is not a branch, so it matches no deployment branch policy on the publish-maven environment and the publish job is rejected before it starts. Trigger on the push to main instead, which deploys from refs/heads/main. Add a gate job that skips a version already carrying its release tag, so pushes that touch native/kotlin/gradle.properties without bumping the version, and repeated manual dispatches, do not try to republish.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Kotlin Maven Central publish is triggered by
pull_request: [closed], so thepublishjob deploys fromrefs/pull/<n>/merge. That ref is not a branch, so itsatisfies no deployment branch policy on the
publish-mavenenvironment and thedeployment is rejected before the job starts:
This cannot be fixed from the environment side: branch policies match branch
names, and a PR merge ref is not a branch. Seen on the 1.0.0 release
(run), where
buildsucceeded and
publishwas rejected.Change
Trigger on the push of the release commit to
mainrather than on the merge ofthe release PR. A push deploys from
refs/heads/main, which the existingmainbranch policy already allows, so the environment needs no change. This also
matches how
publish-packages.ymlis triggered.The push is filtered to
native/kotlin/gradle.properties, the file the releasePR bumps. Because other changes touch that file too, a new
gatejob resolvesVERSION_NAMEand stops the run whenkotlin@<version>is already tagged, soan unrelated push never re-uploads a published release. The same check makes a
repeated
workflow_dispatcha no-op rather than a failed Central upload.workflow_dispatchstill works and is still restricted tomain. Thedry_runinput, the credential handling, the signing steps and thereleasejob are unchanged.
Testing
Not directly exercisable before merge — the trigger only fires on a push to
main. Verified that the YAML parses and that the job graph isgate -> build -> publish -> release, withbuildgated onneeds.gate.outputs.publish. The next release exercises the real path; aworkflow_dispatchagainstmainexercises everything except the push triggeritself.