Repository navigation
CI: fix IntelliJ Marketplace publish (clobbered ZIP version) - #454
Merged
Merged
Conversation
…place publish Two changes that together restore IntelliJ Marketplace publishing (broken on master since 2026-04-30) and remove the structural weakness that made it possible. == Root cause == PR #452 added a standalone "Verify IntelliJ plugin compatibility" step that re-ran :lang:intellij-plugin:verifyPlugin in a separate Gradle invocation, gated only on validate-lang == 'true'. That invocation passed only -PincludeBuildLang/-PincludeBuildAttachLang; critically NOT -PenablePublish=true or -Pjetbrains.publish.suffix=<utc>. verifyPlugin depends on buildPlugin which depends on patchPluginXml, so the second invocation re-evaluated jetbrainsPublishVersionProvider with publishEnabled=false, fell into the bare-base-version branch, and overwrote lang/intellij-plugin/build/distributions/intellij-plugin-0.4.4-SNAPSHOT.zip with a ZIP whose META-INF/plugin.xml said <version>0.4.4-SNAPSHOT</version> clobbering the timestamped artifact the main build had just staged for the intellij-plugin-dist-<sha> upload. publish-snapshot.yml then promoted that clobbered ZIP to Marketplace, which correctly returned HTTP 400 with "channel 'alpha' already contains version 0.4.4-SNAPSHOT" since the bare base version was already published as id 1016162 back when the plugin was first registered. The script's idempotency heuristic (a substring match for "already contains version") then declared the upload a successful no-op, and CI stayed green for two days while no new alpha version landed on Marketplace. Last successful publish: 0.4.4-SNAPSHOT.20260429204308 on Apr 29. Verified locally: :lang:intellij-plugin:patchPluginXml with -PenablePublish=true -Pjetbrains.publish.suffix=20260501TEST produces <version>0.4.4-SNAPSHOT.20260501TEST</version>; the same task without those properties produces <version>0.4.4-SNAPSHOT</version>. == Fix in commit.yml == Collapse to one Gradle invocation that owns both buildPlugin and verifyPlugin. The main "Build the XDK and create a distribution" step now handles all three IntelliJ paths: 1. effective == 'true' (master push with lang/ changes, or manual dispatch with publish flags) -- adds buildSearchableOptions + buildPlugin + verifyPlugin to BUILD_TASKS along with -PenablePublish + -Pjetbrains.publish.suffix. This is the publication path. 2. validate-lang == 'true' && effective != 'true' (PR build with lang/ changes, or manual dispatch with include-lang) -- adds verifyPlugin only, with -PincludeBuildLang/-PincludeBuildAttachLang and no publish properties. The plugin is built and verified but nothing is staged for Marketplace. 3. Otherwise -- the IntelliJ plugin tasks are not in BUILD_TASKS at all. lang/intellij-plugin/build/distributions/ stays empty and there is nothing to clobber. The standalone "Verify IntelliJ plugin compatibility" step and its two "Skip" companion steps are deleted. There is now exactly one place in CI that runs verifyPlugin, and the staged distribution ZIP is by construction the same artifact that was just verified. The "Cache IntelliJ IDE distributions" step keeps the same validate-lang gate (it warms the cache for whichever path runs verifyPlugin in the main build) and the "Upload Plugin Verifier reports" step is unchanged. Marketplace publication trigger is unchanged: the snapshot-publish workflow is kicked off only by master pushes (or manual dispatch), in the same job that fires Homebrew, Docker, and GitHub release updates. PR builds verify the plugin but never publish. == Fix in publish-snapshot.yml == Two defenses so a regression of this class fails loudly instead of hiding behind the green-checkmark camouflage that masked this one: 1. Before calling Marketplace, extract <version> from the ZIP's META-INF/plugin.xml and abort if it doesn't match the publishVersion the CI build claimed it baked in. Marketplace derives the upload version from the ZIP, not from any form field, so a mismatch here means the build produced a stale or bare-versioned artifact -- uploading it can only fail (or worse, succeed against a stale version). 2. Tighten the idempotent-rerun heuristic: only treat an "already contains version" 400 as a successful no-op when the response body explicitly references the version we just tried to upload. The previous loose-substring match accepted "channel 'alpha' already contains version 0.4.4-SNAPSHOT" as proof that 0.4.4-SNAPSHOT.<timestamp> was published -- exactly the substitution that hid this regression for two days. The full Marketplace response is now echoed in the idempotent path so future debuggers don't have to guess at it. The mismatch check uses unzip + sed on the inner plugin JAR, no new tooling required on the runner image.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes IntelliJ Marketplace snapshot publishing in CI by ensuring the verified IntelliJ plugin artifact is the same one staged for publication, and by adding guards that fail loudly if a “bare”/stale versioned ZIP is about to be uploaded.
Changes:
- Consolidates IntelliJ
verifyPluginexecution into the main Gradle build invocation (removing the standalone verifier step that could clobber the staged ZIP version). - Adds a pre-upload sanity check in
publish-snapshot.ymlto confirm the ZIP’s embeddedplugin.xmlversion matches the expected publish version. - Tightens the “already contains version” idempotency heuristic to only treat it as a no-op when the response references the exact version being uploaded.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/publish-snapshot.yml | Adds ZIP/plugin.xml version sanity-check and stricter handling of Marketplace “already contains version” responses. |
| .github/workflows/commit.yml | Collapses IntelliJ verification into the main CI Gradle invocation and removes the standalone verifier step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lagergren
added a commit
that referenced
this pull request
May 1, 2026
Two follow-up tweaks from the PR review. == Drop the IntelliJ IDE distribution cache == Pre-PR, lang/.intellijPlatform/ides was cached via actions/cache@v4 with a step ordered AFTER the main build, so the cache restore was a no-op for the run that needed it (Gradle had already downloaded the IDE). The save still happened post-job, so subsequent runs benefited slightly -- but only via the standalone verifier that this PR has now deleted, so the cache no longer accelerates anything in the new shape. Rather than fix the ordering, drop the cache entirely. ~1 GB per cached IDE eats into the 10 GB per-repo GitHub cache budget that's much more valuable for PR Gradle / dep caches that hit on every build. The verifier only needs the IDE on the rare lang/-changed run (PR validation or master publish), and the IntelliJ Platform Gradle Plugin redownloads it on demand. ~1-2 minutes slower on those rare runs, but it stops displacing caches that hit on every PR. A NOTE comment is added where the cache step used to live so this decision doesn't get re-litigated by someone reading "but we should cache the IDE!" without context. == Better diagnostics in the pre-upload sanity check == Copilot review on PR #454 flagged that the previous version-mismatch diagnostic was ambiguous when the failure was actually structural -- e.g., the find expression returned empty because the IntelliJ Platform Gradle Plugin changed its ZIP layout, not because the version was wrong. Both paths printed the same "<version>: <empty>" message. Split the diagnostic into three explicit failure modes, each with targeted output: 1. INNER_JAR not found in the ZIP -- print top-level ZIP layout so the next maintainer can see what the plugin actually produced and update the find expression. 2. plugin.xml found but no <version> element extracted -- print JAR contents and the first 80 lines of plugin.xml so a malformed descriptor or missing META-INF entry is obvious. 3. Version mismatch (the original case this PR was meant to catch) -- now also echoes the inner JAR path so reviewers can correlate against build/distributions/ in the build artifacts. No behavioural change for the happy path or for the bug-detection path; just better signal when something else goes wrong.
Two follow-up tweaks from the PR review. == Drop the explicit IntelliJ IDE distribution cache == Pre-PR, lang/.intellijPlatform/ides was cached via actions/cache@v4 with a step ordered AFTER the main build, so the cache restore was a no-op for the run that needed it (Gradle had already downloaded the IDE). The save still happened post-job, so subsequent runs benefited slightly -- but only via the standalone verifier that this PR has now deleted, so the explicit cache no longer accelerates anything in the new shape. Rather than fix the ordering, drop the explicit cache entirely. ~1 GB per cached IDE eats into the 10 GB per-repo GitHub cache budget that's much more valuable for PR Gradle / dep caches that hit on every build. The verifier only needs the IDE on the rare lang/-changed run (PR validation or master publish), and the IntelliJ Platform Gradle Plugin redownloads it on demand. ~1-2 minutes slower on those rare runs, but it stops the duplicate explicit cache entry from displacing caches that hit on every PR. A NOTE comment is added where the cache step used to live so this decision doesn't get re-litigated by someone reading "but we should cache the IDE!" without context. Caveat (for completeness, not addressed by this PR): the IntelliJ Platform Gradle Plugin also unpacks the IDE under ~/.gradle/caches/9.5.0/transforms/.../transformed/idea-261*/ which is captured by setup-gradle's gradle-transforms-v1 cache pattern (/home/runner/.gradle/caches/*/transforms/*/) -- a few hundred MB end up in that cache key on lang/-changed runs. This behaviour predates PR #452 (the bug this PR is fixing), is not new, and is left alone here. Eliminating it would require filtering setup-gradle's gradle-home-cache-excludes, with destabilization risk for unrelated artifact transforms. Punted as a separate cache-tuning task if the gradle-transforms key ever becomes a budget problem; this PR is about the publish-version regression, not full IDE-cache eradication. == Better diagnostics in the pre-upload sanity check == Copilot review on PR #454 flagged that the previous version-mismatch diagnostic was ambiguous when the failure was actually structural -- e.g., the find expression returned empty because the IntelliJ Platform Gradle Plugin changed its ZIP layout, not because the version was wrong. Both paths printed the same "<version>: <empty>" message. Split the diagnostic into three explicit failure modes, each with targeted output: 1. INNER_JAR not found in the ZIP -- print top-level ZIP layout so the next maintainer can see what the plugin actually produced and update the find expression. 2. plugin.xml found but no <version> element extracted -- print JAR contents and the first 80 lines of plugin.xml so a malformed descriptor or missing META-INF entry is obvious. 3. Version mismatch (the original case this PR was meant to catch) -- now also echoes the inner JAR path so reviewers can correlate against build/distributions/ in the build artifacts. No behavioural change for the happy path or for the bug-detection path; just better signal when something else goes wrong.
lagergren
force-pushed
the
lagergren/fix-intellij-publish-version-clobber
branch
from
May 1, 2026 19:40
548aaea to
a2ed7fc
Compare
ggleyzer
approved these changes
May 1, 2026
ggleyzer
left a comment
Collaborator
There was a problem hiding this comment.
Blindly trusting it :)
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.
Summary
0.4.4-SNAPSHOT.20260429204308).publish-snapshot.ymlso a regression of this class fails loudly instead of going green.Root cause
PR #452 added a standalone
Verify IntelliJ plugin compatibilitystep that re-ran:lang:intellij-plugin:verifyPluginin a separate Gradle invocation, gated only onvalidate-lang == 'true'. That invocation passed only-PincludeBuildLang/-PincludeBuildAttachLang— not-PenablePublish=trueor-Pjetbrains.publish.suffix=<utc>.verifyPlugindepends onbuildPluginwhich depends onpatchPluginXml, so the second invocation re-evaluatedjetbrainsPublishVersionProviderwithpublishEnabled=false, fell into the bare-base-version branch oflang/intellij-plugin/build.gradle.kts:40-49, and overwrotelang/intellij-plugin/build/distributions/intellij-plugin-0.4.4-SNAPSHOT.zipwith a ZIP whoseMETA-INF/plugin.xmlsaid<version>0.4.4-SNAPSHOT</version>— clobbering the timestamped artifact the main build had just staged forintellij-plugin-dist-<sha>.publish-snapshot.ymlthen promoted that clobbered ZIP. Marketplace correctly returned HTTP 400 withchannel 'alpha' already contains version 0.4.4-SNAPSHOT(the bare base was already published as id 1016162 when the plugin was first registered). The script's idempotency heuristic substring-matched"already contains version"and declared the upload a successful no-op. CI stayed green for two days while no new alpha version landed on Marketplace.Verified locally:
:lang:intellij-plugin:patchPluginXmlwith-PenablePublish=true -Pjetbrains.publish.suffix=20260501TEST→<version>0.4.4-SNAPSHOT.20260501TEST</version><version>0.4.4-SNAPSHOT</version>Fix in
commit.ymlCollapse to one Gradle invocation that owns both
buildPluginandverifyPlugin. The mainBuild the XDK and create a distributionstep now handles all three IntelliJ paths:effective == 'true'(master push with lang/ changes, or manual dispatch with publish flags) — addsbuildSearchableOptions + buildPlugin + verifyPlugintoBUILD_TASKSalong with-PenablePublishand-Pjetbrains.publish.suffix. Publication path.validate-lang == 'true' && effective != 'true'(PR build with lang/ changes, or manual dispatch withinclude-lang) — addsverifyPluginonly, no publish properties. Verification-only path; nothing is staged for Marketplace.BUILD_TASKSat all.lang/intellij-plugin/build/distributions/stays empty, nothing to clobber.The standalone
Verify IntelliJ plugin compatibilitystep and its twoSkipcompanion steps are deleted. There is now exactly one place in CI that runsverifyPlugin, and the staged distribution ZIP is by construction the same artifact that was just verified.Marketplace publication trigger is unchanged — the snapshot-publish workflow is kicked off only by master pushes (or manual dispatch), in the same job that fires Homebrew, Docker, and GitHub release updates. PR builds verify the plugin but never publish.
Fix in
publish-snapshot.ymlTwo defenses so a regression of this class fails loudly:
<version>from the ZIP'sMETA-INF/plugin.xmland abort if it doesn't match the publishVersion the CI build claimed it baked in. Marketplace derives the upload version from the ZIP, not from any form field, so a mismatch means the build produced a stale or bare-versioned artifact."already contains version"400 as a successful no-op when the response body explicitly references the version we just tried to upload. The previous loose substring match acceptedalready contains version 0.4.4-SNAPSHOTas proof that0.4.4-SNAPSHOT.<timestamp>was published — exactly the substitution that hid this regression for two days. Full Marketplace response is now echoed in the idempotent path.Mismatch check uses
unzip + sedon the inner plugin JAR — no new tooling required on the runner image.Test plan
patchPluginXmlwith publish props produces timestamped<version>(verified locally)patchPluginXmlwithout publish props produces bare<version>(verified — the bug)buildSearchableOptions + buildPluginwith publish props produces inner JAR namedintellij-plugin-0.4.4-SNAPSHOT.<suffix>.jar(verified locally)<version>from the inner JAR (verified locally)verifyPlugin(now via the consolidated path)