From e5dda7b1991f188b1ea21780d4f7f99cea3c4827 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Mon, 30 Nov 2026 23:24:00 +0300 Subject: [PATCH] Refuse a tag of another release line A tag runs the release workflow of the commit it points at. With the 17 line out (#293), a 17.x tag on a commit of 21.X.X would publish the 21 line's jars, native images and plugins under a version of the 17 line, and neither Maven Central nor the JetBrains Marketplace takes a version back. The release notes job now refuses a tag that is not a 21.x first, and the jobs that started at once, the jars, the native images and the WebAssembly module, wait for it, so a wrong tag builds and uploads nothing. 17.X.X refuses a tag that is not a 17.x the same way. --- .github/workflows/release.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4546aa7e..2795678f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,10 @@ name: Release # The release notes, release-notes/.md, are on the tag before it is pushed: they are the text of # the GitHub release and the IntelliJ plugin's change notes, and a tag without them publishes nothing. # +# A tag runs the workflow of the commit it points at, so this one releases the 21 line, and it refuses a tag that +# is not a 21.x: a 17.x tag on a commit of this line would publish the 21 line's jars, images and plugins under a +# version of the 17 line. A line cut from this one changes the pattern, as 17.X.X did. +# # Needs seven repository secrets: JRELEASER_MAVENCENTRAL_USERNAME and JRELEASER_MAVENCENTRAL_PASSWORD (the # Central Portal user token), JRELEASER_GPG_SECRET_KEY and JRELEASER_GPG_PASSPHRASE, GRADLE_PUBLISH_KEY and # GRADLE_PUBLISH_SECRET (the Gradle Plugin Portal key) and JETBRAINS_MARKETPLACE_TOKEN (a permanent token of @@ -39,7 +43,7 @@ jobs: # the publish job waits for this one. The IDE does not render Markdown. GitHub's Markdown API renders the # notes as GitHub renders a release, with the runner's gh and jq, so the build needs no converter; sed then # drops the attributes GitHub adds for its own pages, such as its hovercards'. release-notes/README.md says - # how to write them. + # how to write them. The job refuses a tag of another release line first, so every job that builds waits for it. release-notes: name: release notes runs-on: ubuntu-latest @@ -48,6 +52,18 @@ jobs: with: persist-credentials: false + - name: Refuse a tag of another release line + env: + VERSION: ${{ github.ref_name }} + run: | + case "$VERSION" in + 21.*) ;; + *) + echo "::error::${VERSION} is not a version of the 21 line, whose tags are 21.." + exit 1 + ;; + esac + # The shell named, since only then does GitHub run bash with pipefail: a failed gh api fails the step # instead of leaving sed an empty file. - name: Render the release notes for the IDE @@ -77,6 +93,7 @@ jobs: jars: name: jars + needs: release-notes runs-on: ubuntu-latest outputs: deployment-id: ${{ steps.deployment.outputs.id }} @@ -123,6 +140,7 @@ jobs: # instead of throwing it away. macOS on Apple silicon is built here only: ci.yml leaves it out. native-images: name: native image (${{ matrix.runner }}) + needs: release-notes runs-on: ${{ matrix.runner }} timeout-minutes: 90 # bash on Windows too, as in ci.yml. @@ -288,6 +306,7 @@ jobs: # failure here holds back nothing else, and "Re-run failed jobs" builds it again and then opens the draft. wasm: name: wasm + needs: release-notes runs-on: ubuntu-latest timeout-minutes: 60 steps: