From d3b60261a94b62428a3860334ada4893e6e65a31 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Wed, 3 Jun 2026 16:48:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20(release):=20Add=20sync-version?= =?UTF-8?q?-from-dispatch=20composite=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrites pyproject.toml + agent_assembly/__init__.py to match the upstream release_tag (PEP-440 form) from a repository_dispatch payload, so maturin builds the wheel as the requested version rather than whatever is on master. Mapping: v0.0.1-alpha.4 -> 0.0.1a4, -beta. -> b, -rc. -> rc. Empty tag (workflow_dispatch dry-run) is a no-op. Refs AAASM-2459. --- .../sync-version-from-dispatch/action.yml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/actions/sync-version-from-dispatch/action.yml diff --git a/.github/actions/sync-version-from-dispatch/action.yml b/.github/actions/sync-version-from-dispatch/action.yml new file mode 100644 index 0000000..4f09014 --- /dev/null +++ b/.github/actions/sync-version-from-dispatch/action.yml @@ -0,0 +1,60 @@ +name: Sync version from dispatch payload +description: >- + Rewrite the package version in pyproject.toml and agent_assembly/__init__.py + to match the upstream agent-assembly release tag carried in the + repository_dispatch client_payload, BEFORE maturin reads pyproject.toml. + + Without this, maturin would build whatever version is currently checked in + on master (which lags the upstream bumper), so the wheel filename would + collide with an already-published PyPI version. See AAASM-2459 for the + alpha-4 incident that motivated this action. + + When `release_tag` is empty (workflow_dispatch dry-run mode), the step is a + no-op and the files keep whatever version is on master — useful for local + CI smoke tests. + +inputs: + release_tag: + description: >- + Upstream agent-assembly release tag from + `github.event.client_payload.release_tag` (e.g. `v0.0.1-alpha.4`). + Empty string is allowed and treated as a no-op (dry-run). + required: true + +runs: + using: composite + steps: + - name: Sync pyproject.toml + __init__.py version + shell: bash + env: + AASM_TAG: ${{ inputs.release_tag }} + run: | + set -euo pipefail + if [ -z "${AASM_TAG}" ]; then + echo "AASM_TAG is empty (workflow_dispatch dry-run) — leaving version files untouched." + exit 0 + fi + # PEP-440 conversion from git tag form: + # v0.0.1-alpha.4 -> 0.0.1a4 + # v0.0.1-beta.2 -> 0.0.1b2 (not used today; future-proofing) + # v0.0.1-rc.1 -> 0.0.1rc1 (not used today; future-proofing) + # v1.2.3 -> 1.2.3 + pep440="${AASM_TAG#v}" + pep440="${pep440//-alpha./a}" + pep440="${pep440//-beta./b}" + pep440="${pep440//-rc./rc}" + echo "Mapped upstream tag '${AASM_TAG}' to PEP-440 version '${pep440}'" + + # pyproject.toml: line 7 currently `version = "0.0.2"`. sed in place. + sed -i.bak "s|^version = \"[^\"]*\"|version = \"${pep440}\"|" pyproject.toml + rm -f pyproject.toml.bak + + # __version__ lives in agent_assembly/__init__.py (verified for AAASM-2459). + sed -i.bak "s|^__version__ = \"[^\"]*\"|__version__ = \"${pep440}\"|" agent_assembly/__init__.py + rm -f agent_assembly/__init__.py.bak + + echo "--- pyproject.toml version line ---" + grep -n '^version = ' pyproject.toml + echo "--- agent_assembly/__init__.py __version__ line ---" + grep -n '^__version__ = ' agent_assembly/__init__.py + echo "Version sync complete: building wheel as agent-assembly==${pep440}" From a25a6ded13f4476591045e1cc0fcbceedf7c75cd Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Wed, 3 Jun 2026 16:49:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20(release):=20Wire=20sync-ver?= =?UTF-8?q?sion-from-dispatch=20step=20into=20all=205=20jobs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inserts the composite action call before each maturin invocation in release-python.yml (1 sdist + 4 wheel jobs: linux-x86_64, linux-aarch64, macos-arm64, macos-x86_64). Without this, repository_dispatch from agent-assembly fires the workflow but maturin reads the stale version in the master pyproject.toml, producing a wheel that collides with an already-published PyPI release. Refs AAASM-2459. --- .github/workflows/release-python.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index d0765e7..ae6c284 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -44,6 +44,10 @@ jobs: - uses: actions/setup-python@v6 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Sync version from dispatch payload + uses: ./.github/actions/sync-version-from-dispatch + with: + release_tag: ${{ github.event.client_payload.release_tag }} - name: Build source distribution uses: PyO3/maturin-action@v1 with: @@ -86,6 +90,10 @@ jobs: rm -f agent_assembly/bin/aasm-x86_64-unknown-linux-gnu.tar.gz chmod +x agent_assembly/bin/aasm echo "Bundled aasm binary into wheel" + - name: Sync version from dispatch payload + uses: ./.github/actions/sync-version-from-dispatch + with: + release_tag: ${{ github.event.client_payload.release_tag }} - name: Build wheel uses: PyO3/maturin-action@v1 with: @@ -154,6 +162,10 @@ jobs: rm -f agent_assembly/bin/aasm-aarch64-unknown-linux-gnu.tar.gz chmod +x agent_assembly/bin/aasm echo "Bundled aasm binary into wheel" + - name: Sync version from dispatch payload + uses: ./.github/actions/sync-version-from-dispatch + with: + release_tag: ${{ github.event.client_payload.release_tag }} - name: Build wheel uses: PyO3/maturin-action@v1 with: @@ -216,6 +228,10 @@ jobs: echo "Bundled aasm binary into wheel" - name: Install protoc (macOS) run: brew install protobuf + - name: Sync version from dispatch payload + uses: ./.github/actions/sync-version-from-dispatch + with: + release_tag: ${{ github.event.client_payload.release_tag }} - name: Build wheel uses: PyO3/maturin-action@v1 with: @@ -259,6 +275,10 @@ jobs: echo "Bundled aasm binary into wheel" - name: Install protoc (macOS) run: brew install protobuf + - name: Sync version from dispatch payload + uses: ./.github/actions/sync-version-from-dispatch + with: + release_tag: ${{ github.event.client_payload.release_tag }} - name: Build wheel uses: PyO3/maturin-action@v1 with: