This is an automated email from the ASF dual-hosted git repository.

luigidemasi pushed a commit to branch fix/stage-release-candidates
in repository https://gitbox.apache.org/repos/asf/camel-kit.git

commit 08dc8f0d2b4b521f2e3e25b50489141cdadf1d9e
Author: Luigi De Masi <[email protected]>
AuthorDate: Thu Dec 3 18:18:55 2026 +0100

    Fix #125: Stage signed release candidates for a Camel PMC vote
    
    Build each selected Maven target from its numbered RC source archive. 
Document how voters verify the candidate and how the release manager promotes 
the voted SVN revision and Central deployment.
    
    Co-authored-by: OpenAI Codex <[email protected]>
---
 .github/workflows/release.yml             |  44 ++++++---
 CHANGELOG.md                              |   3 +
 docs/modules/ROOT/pages/contributing.adoc |  23 +++--
 docs/releasing.md                         | 158 ++++++++++++++++++++++++++----
 tools/release_source.sh                   |  23 +++++
 tools/release_target.py                   |  10 +-
 tools/test_release_target.py              |  80 ++++++++++++---
 7 files changed, 287 insertions(+), 54 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index cbbb9846..16e87c2d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,7 +9,7 @@ on:
         type: choice
         options: [parent, kit, knowledge]
       tag:
-        description: 'Prepared release tag (for example, camel-kit-0.4.2)'
+        description: 'Signed candidate tag (for example, camel-kit-0.4.2-rc1)'
         required: true
         type: string
       expected_sha:
@@ -26,6 +26,11 @@ concurrency:
 
 jobs:
   release:
+    if: github.ref == 'refs/heads/main'
+    env:
+      RELEASE_TARGET: ${{ inputs.target }}
+      RELEASE_TAG: ${{ inputs.tag }}
+      EXPECTED_SHA: ${{ inputs.expected_sha }}
     runs-on: ubuntu-latest
     timeout-minutes: 120
 
@@ -36,17 +41,23 @@ jobs:
           ref: refs/tags/${{ inputs.tag }}
           persist-credentials: false
 
-      - name: Verify release identity
-        env:
-          RELEASE_TARGET: ${{ inputs.target }}
-          RELEASE_TAG: ${{ inputs.tag }}
-          EXPECTED_SHA: ${{ inputs.expected_sha }}
+      - name: Verify the candidate and extract the source to build
         run: |
           set -euo pipefail
+          export GNUPGHOME="$RUNNER_TEMP/camel-keys"
+          install -d -m 700 "$GNUPGHOME"
+          curl -fsSL https://downloads.apache.org/camel/KEYS | gpg --batch 
--import
+          ref="refs/tags/$RELEASE_TAG"
           [[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]]
-          [[ "$(git rev-parse HEAD)" == "$EXPECTED_SHA" ]]
-          [[ "$(git rev-parse "refs/tags/${RELEASE_TAG}^{commit}")" == 
"$EXPECTED_SHA" ]]
+          [[ "$(git rev-parse HEAD)" == "$EXPECTED_SHA" && "$(git rev-parse 
"$ref^{commit}")" == "$EXPECTED_SHA" ]]
+          [[ "$(git for-each-ref --format='%(tag)' "$ref")" == "$RELEASE_TAG" 
]]
+          git verify-tag "$ref"
           python3 tools/release_target.py "$RELEASE_TARGET" --tag 
"$RELEASE_TAG" --check-published-parent
+          mkdir "$RUNNER_TEMP/candidate"
+          source_name="apache-${RELEASE_TAG%-rc*}-src"
+          tools/release_source.sh "$RELEASE_TARGET" "$RELEASE_TAG" > 
"$RUNNER_TEMP/candidate/$source_name.tar.gz"
+          tar -xzf "$RUNNER_TEMP/candidate/$source_name.tar.gz" -C 
"$RUNNER_TEMP"
+          echo "SOURCE_DIR=$RUNNER_TEMP/$source_name" >> "$GITHUB_ENV"
 
       - name: Set up JDK 21 and Maven Central settings
         uses: actions/[email protected]
@@ -80,6 +91,17 @@ jobs:
           GPG_ID: ${{ secrets.GPG_ID }}
           MAVEN_USERNAME: ${{ secrets.MVN_CENTRAL_USER }}
           MAVEN_PASSWORD: ${{ secrets.MVN_CENTRAL_PASSWORD }}
-          RELEASE_TARGET: ${{ inputs.target }}
-          RELEASE_TAG: ${{ inputs.tag }}
-        run: ./.github/workflows/release.sh
+        run: |
+          cd "$SOURCE_DIR"
+          ./.github/workflows/release.sh
+          shopt -s globstar nullglob
+          bundles=(**/target/central-publishing/central-bundle.zip)
+          [[ ${#bundles[@]} == 1 ]]
+          cp "${bundles[0]}" "$RUNNER_TEMP/candidate/"
+
+      - name: Save the source archive and Maven staging bundle for review
+        uses: actions/[email protected]
+        with:
+          name: ${{ inputs.tag }}-run-${{ github.run_attempt }}
+          path: ${{ runner.temp }}/candidate/
+          if-no-files-found: error
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2c4d1ad..9a337358 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0
 
 ### Changed
 
+- Maven releases now build from the signed RC tag’s source archive. The 
release manager stages the source
+  for a Camel PMC vote and promotes the approved source and Central deployment 
together (#125).
+
 - The development Camel CLI plugin ships its skill catalog, parser providers 
and runtime dependencies in one JAR
   for JBang and Camel Launcher. Packaging rejects duplicate pack resources and 
verifies Mule parsing from the built JAR (#201).
 
diff --git a/docs/modules/ROOT/pages/contributing.adoc 
b/docs/modules/ROOT/pages/contributing.adoc
index 5dec5958..e78a318b 100644
--- a/docs/modules/ROOT/pages/contributing.adoc
+++ b/docs/modules/ROOT/pages/contributing.adoc
@@ -445,16 +445,19 @@ the MCP runner with the shipped target profiles. Use the 
corresponding
 POM (`pom.xml` with `-N`, `kit/pom.xml`, or `knowledge/pom.xml`) when 
preparing or staging a
 release; never deploy the root reactor to release one product.
 
-Tags are `camel-kit-parent-X.Y.Z`, `camel-kit-X.Y.Z` and 
`camel-kit-knowledge-X.Y.Z`.
-`tools/release_target.py` validates the selected target, its module versions 
and its tag.
-The manually dispatched `Stage Maven Release` workflow checks the exact tag 
and reviewed
-commit SHA, tests and signs that target, and uploads a validated staging 
deployment.
-Automatic promotion is disabled.
-
-Apache releases follow the 
https://www.apache.org/legal/release-policy.html[ASF release policy]
-and the Camel xref:manual::release-guide.adoc[release guide], including a 
source release
-candidate and successful PMC vote before publication. The staging workflow 
does not automate
-that whole process. See `docs/releasing.md` in the repository for the 
preparation steps.
+The final tags are `camel-kit-parent-X.Y.Z`, `camel-kit-X.Y.Z` and 
`camel-kit-knowledge-X.Y.Z`.
+Append `-rc1`, `-rc2` and so on for successive signed candidate tags.
+Dispatch `Stage Maven Release` from `main` with the target, RC tag and 
reviewed commit SHA.
+It verifies the tag, builds and signs that target from its source archive, and 
stages the Maven artifacts in Central.
+
+The release manager signs the source archive, stages it with its signature and 
SHA-512 in
+`dist/dev/camel/camel-kit/<rc-tag>/`, and calls a vote on 
`[email protected]`.
+PMC voters verify and build the staged source. After a passing vote, the 
release manager copies
+the approved SVN revision to `dist/release`, publishes the voted Central 
deployment, and creates
+the final tag at the same commit.
+See the 
https://github.com/apache/camel-kit/blob/main/docs/releasing.md[release 
instructions],
+the https://www.apache.org/legal/release-policy.html[ASF release policy] and
+the Camel xref:manual::release-guide.adoc[release guide].
 
 Kit pins a tested Knowledge runner using `knowledge.mcp.group-id` and 
`knowledge.mcp.version`
 in `distribution.properties`. Published Knowledge 
{camel-kit-knowledge-version} retains its
diff --git a/docs/releasing.md b/docs/releasing.md
index e2f5efbe..069bd604 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -3,10 +3,10 @@
 The repository contains three Maven release targets and a separate index-data 
release.
 Run all commands below from the repository root with `./mvnw`.
 
-| Target | POM | Tag | Scope |
+| Target | POM | Final tag | Scope |
 |---|---|---|---|
 | Shared parent | `pom.xml` | `camel-kit-parent-X.Y.Z` | Parent POM only 
(`-N`) |
-| Kit | `kit/pom.xml` | `camel-kit-X.Y.Z` | Kit and its five modules |
+| Kit | `kit/pom.xml` | `camel-kit-X.Y.Z` | Kit and its modules |
 | Knowledge | `knowledge/pom.xml` | `camel-kit-knowledge-X.Y.Z` | Knowledge 
code; excludes index data |
 | Index | `knowledge/index/src/main/resources/` | 
`knowledge-index-v2-YYYY.MM.DD-HHMMSS` | Validated ZIP and manifest |
 
@@ -69,7 +69,7 @@ a v1 directory for the released 0.0.2 runner. Lucene 10 
runners accept v1 and v2
 
 1. Start from reviewed source on a release branch. Change only the selected 
product
    POM version and its child parent versions (or only the root version for a 
parent
-   release). Set its SCM tag. Keep the other product's version unchanged.
+   release). Set its SCM tag to the final tag in the table. Keep the other 
product's version unchanged.
 2. For a product release, set its shared parent to the intended released 
version.
    Confirm that this parent resolves from the public repository with an empty 
local
    Maven repository. Do not rely on a locally installed snapshot parent.
@@ -84,21 +84,143 @@ a v1 directory for the released 0.0.2 runner. Lucene 10 
runners accept v1 and v2
    `./mvnw -B -Psourcecheck validate`, then
    `./mvnw -B -Plinux-ship-certification -Deval.requireVectors=true clean 
install`
    on Linux. The Knowledge quality gate must have a working vector leg.
-5. Validate the selected target, for example
-   `python3 tools/release_target.py kit --tag camel-kit-X.Y.Z`.
-   Review and sign the source commit and tag; record its full SHA.
-6. Dispatch **Stage Maven Release** with the target, exact tag, and expected 
SHA.
-   It tests and signs only the selected reactor and uploads a validated Central
-   staging deployment. `autoPublish` is disabled. No product release command 
should
-   deploy the entire root reactor.
-7. Prepare the source release candidate, signatures, checksums, verification 
and PMC
-   vote following the [Camel release 
guide](https://camel.apache.org/manual/release-guide.html)
-   and [ASF release policy](https://www.apache.org/legal/release-policy.html).
-   The staging workflow is an artifact-building aid, not a complete ASF release
-   process. Promote artifacts and publish release announcements only after 
approval.
-8. Advance only the released target to its next snapshot and restore its SCM 
tag to
-   `HEAD`. For Kit, synchronize launcher fallback versions again. Verify 
clean-cache
-   installation of the released CLI/plugin or standalone Knowledge runner.
+5. Sign the release commit. Choose the next candidate number starting at 1. 
Append
+   `-rcN` to the final tag. The Maven version and POM SCM tag stay final so the
+   approved candidate can be published without rebuilding. Sign the annotated 
RC
+   tag with an OpenPGP key in [Camel 
KEYS](https://downloads.apache.org/camel/KEYS).
+   For example, from the reviewed Kit release commit:
+
+   ```bash
+   target=kit
+   final=camel-kit-0.4.2
+   rc="$final-rc1"
+   sha=$(git rev-parse HEAD)
+   python3 tools/release_target.py "$target" --tag "$rc" 
--check-published-parent
+   git verify-commit "$sha"
+   git -c gpg.format=openpgp tag -s -u "$FINGERPRINT" -m "$rc" "$rc" "$sha"
+   git verify-tag "$rc"
+   git push origin "refs/tags/$rc"
+   ```
+
+## Stage the candidate
+
+Check the top-level LICENSE and NOTICE against the files in the selected source
+archive, including the vendored graph visualization libraries for Kit and the 
model,
+tokenizer and test data for Knowledge. Correct any missing licensing material 
in the
+release commit before calling the vote.
+
+Configure Maven staging with a Central token for the project's namespace
+(`MVN_CENTRAL_USER` and `MVN_CENTRAL_PASSWORD`) and the existing Maven signing
+secrets (`GPG_KEY`, base64-encoded, and `GPG_ID`). The source archive is signed
+on the release manager's workstation.
+
+Dispatch **Stage Maven Release** from `main` with the target, RC tag and 
reviewed
+40-character commit SHA. The workflow verifies the tag against Camel KEYS, 
archives
+the shared build files and selected target from that commit, and builds the 
Maven
+artifacts from the unpacked source. Central stops at `VALIDATED`. Record the
+deployment ID from the build log and the successful Actions run and attempt.
+Download its artifact named `<rc>-run-<attempt>`. It contains the source 
tarball and
+the exact `central-bundle.zip` supplied to Central. Voters can inspect the 
bundle
+using the Actions run link.
+
+On the release manager's workstation, set `candidate` to the absolute directory
+containing the two downloaded files. From the checked-out, verified RC, 
compare the
+source tar streams before signing the downloaded archive. Use the release 
manager's
+full OpenPGP fingerprint from Camel KEYS.
+
+```bash
+set -euo pipefail
+archive="apache-$final-src.tar.gz"
+tools/release_source.sh "$target" "$rc" | gzip -dc > "$candidate/from-tag.tar"
+gzip -dc "$candidate/$archive" | cmp "$candidate/from-tag.tar" -
+cd "$candidate"
+gpg --armor --local-user "$FINGERPRINT" --detach-sign "$archive"
+sha512sum "$archive" > "$archive.sha512"
+sha512sum central-bundle.zip
+```
+
+Use the ASF distribution Subversion repository. For the first release, create
+`dev/camel/camel-kit` and `release/camel/camel-kit` under
+`https://dist.apache.org/repos/dist` with `svn mkdir` if absent. Stage the 
three
+source files together in a fresh RC directory and record the printed SVN 
revision.
+
+```bash
+dist=https://dist.apache.org/repos/dist
+dev="$dist/dev/camel/camel-kit/$rc"
+svnmucc -m "Stage $rc" mkdir "$dev" \
+  put "$archive" "$dev/$archive" put "$archive.asc" "$dev/$archive.asc" \
+  put "$archive.sha512" "$dev/$archive.sha512"
+```
+
+## Vote on [email protected]
+
+Start a `[VOTE] Release Apache Camel Kit <target> <version> (RC N)` thread.
+Identify the target and version, signed tag and full Git SHA, source URL and
+SVN revision, source SHA-512, signing key fingerprint and Camel KEYS URL.
+Include the Actions artifact link, Maven bundle SHA-512, Central deployment ID
+and the vote deadline (normally at least 72 hours). Invite binding and
+nonbinding votes. For Knowledge include the licensing review described above.
+
+Before casting a binding +1, each PMC voter downloads the three source files at
+the stated revision, checks the digest against the vote email, verifies the
+signature and fingerprint against Camel KEYS, inspects LICENSE, NOTICE and
+bundled material, and builds and tests the source on their own machine.
+Set `dev`, `revision`, `archive` and `final` from the vote email. Export the 
exact
+revision into a new directory:
+
+```bash
+svn export -r "$revision" "$dev@$revision" verify-rc
+cd verify-rc
+curl -fsSLo KEYS https://downloads.apache.org/camel/KEYS
+gpg --import KEYS
+sha512sum -c "$archive.sha512"
+gpg --verify "$archive.asc" "$archive"
+tar -xzf "$archive"
+cd "apache-$final-src"
+# Run the line for the target under vote with JDK 21:
+./mvnw -B -N clean verify                                         # parent
+./mvnw -B -f kit/pom.xml -Plinux-ship-certification clean verify   # Kit, on 
Linux
+./mvnw -B -f knowledge/pom.xml -Deval.requireVectors=true clean verify  # 
Knowledge
+```
+
+Compare the bundle digest with the vote email, inspect its Maven coordinates 
and
+verify the artifact signatures. The release manager posts a `[RESULT][VOTE]`
+on the same list with the tally, distinguishing Camel PMC votes. Approval 
requires
+at least three binding +1 votes and more binding +1 than binding -1 votes.
+See the [ASF release 
policy](https://www.apache.org/legal/release-policy.html#release-approval)
+and the [Camel release 
guide](https://camel.apache.org/manual/release-guide.html).
+
+## Promote the approved candidate
+
+After the passing result, use the SVN revision, Git SHA and Central deployment 
ID
+recorded in the vote. Copy the voted source, signature and checksum in one
+server-side operation. The destination is a new directory named after the 
final tag.
+
+```bash
+svnmucc -m "Release $final (approved $rc)" cp "$revision" "$dev" 
"$dist/release/camel/camel-kit/$final"
+```
+
+Confirm the files and checksum on [Apache 
Downloads](https://downloads.apache.org/camel/).
+In [Central Portal](https://central.sonatype.com/publishing/deployments), 
select the voted
+deployment ID, choose **Publish**, and verify that it reaches `PUBLISHED`. 
From the Git
+checkout, create and push the signed final tag at the approved SHA. If 
promotion is
+interrupted, inspect the destination, deployment ID and tag and resume the 
missing steps
+with the same artifacts.
+
+```bash
+git -c gpg.format=openpgp tag -s -u "$FINGERPRINT" -m "$final" "$final" "$sha"
+git push origin "refs/tags/$final"
+```
+
+Verify clean-cache installation from the public repository. Update the 
download page,
+publish any GitHub release against the final tag and announce the release on 
the Camel
+lists. Advance only the released target to its next snapshot, restore its SCM 
tag to
+`HEAD`, and synchronize Kit's launcher versions when releasing Kit.
+
+If the vote fails or the candidate changes, announce the outcome, drop its 
Central
+deployment and remove the abandoned directory from `dist/dev`. Preserve the 
old tag.
+Prepare a new signed RC with the next number, stage it and start a fresh vote. 
A
+rerun that produces a different bundle also requires a fresh candidate and 
vote.
 
 Before the nightly and manual Kit snapshot deployments, `python3 
tools/check_camel_mcp_runner.py` resolves the
 pinned runner with an empty Maven repository. When the pin is a snapshot and 
its release JAR appears on Maven
diff --git a/tools/release_source.sh b/tools/release_source.sh
new file mode 100755
index 00000000..8f349ce0
--- /dev/null
+++ b/tools/release_source.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Write the selected Maven target's source archive to stdout from its 
checked-out RC tag.
+set -euo pipefail
+
+target=${1:?expected parent, kit or knowledge}
+tag=${2:?expected candidate tag}
+python3 tools/release_target.py "$target" --tag "$tag" >/dev/null
+commit=$(git rev-parse "refs/tags/$tag^{commit}")
+if [[ "$(git rev-parse HEAD)" != "$commit" ]]; then
+  echo "Check out the candidate tag $tag before creating its source archive" 
>&2
+  exit 1
+fi
+
+# Include shared build inputs and the data used by the selected product's 
tests.
+paths=(LICENSE NOTICE README.md CONTRIBUTING.md CHANGELOG.md docs tools 
.github/workflows/release.sh .mvn mvnw mvnw.cmd
+       pom.xml camel-kit-formatter-config.xml distribution.properties)
+if [[ "$target" != parent ]]; then
+  paths+=("$target")
+fi
+if [[ "$target" == kit ]]; then
+  paths+=(jbang-catalog.json)
+fi
+git -c tar.umask=0002 archive --prefix="apache-${tag%-rc*}-src/" --format=tar 
"$commit" -- "${paths[@]}" | gzip -n
diff --git a/tools/release_target.py b/tools/release_target.py
index f7f403fa..129f84fd 100644
--- a/tools/release_target.py
+++ b/tools/release_target.py
@@ -26,10 +26,12 @@ def validate(root, target, tag=None, snapshot=False):
         raise ValueError(f"{path}: expected a {'snapshot' if snapshot else 
'release'} version, got {version}")
     if pom.findtext(NS + "artifactId") != artifact:
         raise ValueError(f"{path}: unexpected artifactId")
-    if tag is not None and tag != f"{artifact}-{version}":
-        raise ValueError(f"Tag must be {artifact}-{version}")
-    if tag is not None and pom.findtext(f"{NS}scm/{NS}tag") != tag:
-        raise ValueError(f"{path}: SCM tag must match {tag}")
+    if tag is not None:
+        final_tag = f"{artifact}-{version}"
+        if not re.fullmatch(re.escape(final_tag) + r"-rc[1-9][0-9]*", tag):
+            raise ValueError(f"Tag must be {final_tag}-rcN (N starts at 1)")
+        if pom.findtext(f"{NS}scm/{NS}tag") != final_tag:
+            raise ValueError(f"{path}: SCM tag must match the final tag 
{final_tag}")
     if target != "parent":
         parent = pom.find(NS + "parent")
         if (parent is None or parent.findtext(NS + "artifactId") != 
"camel-kit-parent"
diff --git a/tools/test_release_target.py b/tools/test_release_target.py
index 6622fec2..5bc60d17 100644
--- a/tools/test_release_target.py
+++ b/tools/test_release_target.py
@@ -1,8 +1,11 @@
-import tempfile
-import unittest
+import io
 import os
 import shutil
 import subprocess
+import tarfile
+import tempfile
+import unittest
+import xml.etree.ElementTree as ET
 from pathlib import Path
 
 from release_target import validate
@@ -36,17 +39,17 @@ class ReleaseTargetTest(unittest.TestCase):
         destination.write_text(content)
 
     def test_kit_release_ignores_knowledge_snapshot(self):
-        self.assertEqual(("0.4.2", ["-f", "kit/pom.xml"]), validate(self.root, 
"kit", "camel-kit-0.4.2"))
+        self.assertEqual(("0.4.2", ["-f", "kit/pom.xml"]), validate(self.root, 
"kit", "camel-kit-0.4.2-rc1"))
 
     def test_parent_cannot_recurse_into_products(self):
-        self.assertEqual(("1.0.0", ["-N"]), validate(self.root, "parent", 
"camel-kit-parent-1.0.0"))
+        self.assertEqual(("1.0.0", ["-N"]), validate(self.root, "parent", 
"camel-kit-parent-1.0.0-rc1"))
 
     def test_kit_release_requires_a_released_camel_host(self):
         for version in ["4.24.0-SNAPSHOT", "4.24.0-20261117.143648-37", 
"4.24.0-RC1", ""]:
             with self.subTest(version=version):
                 (self.root / 
"distribution.properties").write_text(f"camel.cli.version={version}\n")
                 with self.assertRaisesRegex(ValueError, "released Camel CLI 
host"):
-                    validate(self.root, "kit", "camel-kit-0.4.2")
+                    validate(self.root, "kit", "camel-kit-0.4.2-rc1")
 
     def test_kit_release_requires_a_release_version_for_the_mcp_runner(self):
         for version in ("", "4.22.3-SNAPSHOT", "4.22.3-20261125.143528-32", 
"4.22.3-RC1"):
@@ -54,7 +57,7 @@ class ReleaseTargetTest(unittest.TestCase):
                 (self.root / "distribution.properties").write_text(
                     f"camel.cli.version=4.24.0\ncamel.mcp.version={version}\n")
                 with self.assertRaisesRegex(ValueError, "released Camel MCP 
runner"):
-                    validate(self.root, "kit", "camel-kit-0.4.2")
+                    validate(self.root, "kit", "camel-kit-0.4.2-rc1")
 
     def 
test_snapshot_pins_are_allowed_for_development_and_other_products(self):
         (self.root / "distribution.properties").write_text(
@@ -95,13 +98,68 @@ class ReleaseTargetTest(unittest.TestCase):
 
     def test_wrong_product_tag_is_rejected(self):
         with self.assertRaisesRegex(ValueError, "Tag must be"):
-            validate(self.root, "kit", "camel-kit-knowledge-0.4.2")
+            validate(self.root, "kit", "camel-kit-knowledge-0.4.2-rc1")
+
+    def test_staging_requires_a_numbered_candidate(self):
+        for suffix in ("", "-rc", "-rc0", "-rc01", "-rc1-extra"):
+            with self.subTest(suffix=suffix), 
self.assertRaisesRegex(ValueError, "Tag must be"):
+                validate(self.root, "kit", "camel-kit-0.4.2" + suffix)
+        self.assertEqual("0.4.2", validate(self.root, "kit", 
"camel-kit-0.4.2-rc12")[0])
 
     def test_scm_tag_must_identify_the_selected_release(self):
         path = self.root / "kit/pom.xml"
         path.write_text(path.read_text().replace("<tag>camel-kit-0.4.2</tag>", 
"<tag>HEAD</tag>"))
         with self.assertRaisesRegex(ValueError, "SCM tag must match"):
-            validate(self.root, "kit", "camel-kit-0.4.2")
+            validate(self.root, "kit", "camel-kit-0.4.2-rc1")
+
+    def test_source_archive_contains_the_selected_product_at_the_tag(self):
+        repository = Path(__file__).resolve().parent.parent
+        for path in ("LICENSE", "NOTICE", "README.md", "CONTRIBUTING.md", 
"CHANGELOG.md", "docs/releasing.md",
+                     ".mvn/wrapper/maven-wrapper.properties", "mvnw", 
"mvnw.cmd", "camel-kit-formatter-config.xml",
+                     ".github/workflows/release.sh", 
"tools/release_target.py", "tools/sync_distribution_mirrors.py"):
+            (self.root / path).parent.mkdir(parents=True, exist_ok=True)
+            shutil.copy(repository / path, self.root / path)
+        (self.root / "jbang-catalog.json").write_text("{}")
+        self.pom("knowledge/pom.xml", "camel-kit-knowledge", "0.0.3", 
"camel-kit-parent", "1.0.0", ["mcp"])
+        self.pom("knowledge/mcp/pom.xml", "camel-kit-knowledge-mcp", None, 
"camel-kit-knowledge", "0.0.3")
+
+        def git(*args):
+            subprocess.run(["git", "-c", "user.name=Test", "-c", 
"[email protected]",
+                            "-c", "commit.gpgsign=false", "-c", 
"tag.gpgsign=false", *args],
+                           cwd=self.root, check=True, capture_output=True)
+
+        git("init")
+        git("add", ".")
+        git("commit", "-m", "Candidate fixture")
+        for target, final_tag in (("parent", "camel-kit-parent-1.0.0"), 
("kit", "camel-kit-0.4.2"),
+                                  ("knowledge", "camel-kit-knowledge-0.0.3")):
+            with self.subTest(target=target):
+                tag = final_tag + "-rc1"
+                git("tag", tag)
+                (self.root / "NOTICE").write_text("uncommitted change")
+                result = subprocess.check_output([repository / 
"tools/release_source.sh", target, tag], cwd=self.root)
+                prefix = "apache-" + final_tag + "-src/"
+                with tarfile.open(fileobj=io.BytesIO(result), mode="r:gz") as 
archive:
+                    names = archive.getnames()
+                    self.assertEqual((repository / "NOTICE").read_bytes(), 
archive.extractfile(prefix + "NOTICE").read())
+                    self.assertIn(prefix + "LICENSE", names)
+                    self.assertTrue(archive.getmember(prefix + "mvnw").mode & 
0o100)
+                    self.assertEqual(target == "kit", prefix + 
"kit/core/pom.xml" in names)
+                    self.assertEqual(target == "knowledge", prefix + 
"knowledge/mcp/pom.xml" in names)
+                    self.assertEqual(target == "kit", prefix + 
"jbang-catalog.json" in names)
+        git("add", "NOTICE")
+        git("commit", "-m", "Move HEAD beyond candidate")
+        result = subprocess.run([repository / "tools/release_source.sh", 
"kit", "camel-kit-0.4.2-rc1"],
+                                cwd=self.root, capture_output=True)
+        self.assertNotEqual(0, result.returncode)
+        self.assertEqual(b"", result.stdout)
+
+    def test_central_release_stops_at_validation(self):
+        pom = ET.parse(Path(__file__).resolve().parents[1] / "pom.xml")
+        release = pom.find(".//{*}profile[{*}id='release']")
+        plugin = 
release.find(".//{*}plugin[{*}artifactId='central-publishing-maven-plugin']/{*}configuration")
+        self.assertEqual("false", plugin.findtext("{*}autoPublish"))
+        self.assertEqual("validated", plugin.findtext("{*}waitUntil"))
 
     def test_release_script_invokes_only_the_selected_reactor(self):
         repository = Path(__file__).resolve().parent.parent
@@ -114,9 +172,9 @@ class ReleaseTargetTest(unittest.TestCase):
         self.pom("knowledge/pom.xml", "camel-kit-knowledge", "0.0.3", 
"camel-kit-parent", "1.0.0", ["mcp"])
         self.pom("knowledge/mcp/pom.xml", "camel-kit-knowledge-mcp", None, 
"camel-kit-knowledge", "0.0.3")
         for target, tag, scope in [
-            ("parent", "camel-kit-parent-1.0.0", ["-N"]),
-            ("kit", "camel-kit-0.4.2", ["-f", "kit/pom.xml"]),
-            ("knowledge", "camel-kit-knowledge-0.0.3", ["-f", 
"knowledge/pom.xml"]),
+            ("parent", "camel-kit-parent-1.0.0-rc1", ["-N"]),
+            ("kit", "camel-kit-0.4.2-rc1", ["-f", "kit/pom.xml"]),
+            ("knowledge", "camel-kit-knowledge-0.0.3-rc1", ["-f", 
"knowledge/pom.xml"]),
         ]:
             with self.subTest(target=target):
                 result = subprocess.run(["bash", str(repository / 
".github/workflows/release.sh")],

Reply via email to