11name : Publish marketplace pack
22
33on :
4+ workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : Existing signed v* tag matching the native-qualified source
8+ required : true
9+ type : string
10+ qualification_artifact_id :
11+ description : Same-repository successful main validate artifact ID
12+ required : true
13+ type : string
14+ qualification_artifact_sha256 :
15+ description : Exact immutable qualification artifact SHA256
16+ required : true
17+ type : string
418 push :
519 tags :
620 - " v*"
721
822permissions :
923 contents : read
24+ actions : read
25+
26+ env :
27+ RELEASE_TAG : ${{ inputs.tag || github.ref_name }}
28+ QUALIFICATION_ID : ${{ inputs.qualification_artifact_id }}
29+ QUALIFICATION_SHA256 : ${{ inputs.qualification_artifact_sha256 }}
1030
1131jobs :
1232 validate :
33+ if : github.event_name == 'push' || github.ref == 'refs/heads/main'
1334 runs-on : ubuntu-latest
35+ timeout-minutes : 20
36+ outputs :
37+ source_commit : ${{ steps.source.outputs.commit }}
1438 steps :
39+ - name : Validate release tag syntax
40+ run : |
41+ [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$ ]]
42+
1543 - name : Check out tagged source
1644 uses : actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
1745 with :
1846 # Signature verification needs the annotated tag object, not only the
1947 # commit that a shallow tag checkout resolves to.
2048 fetch-depth : 0
49+ ref : ${{ env.RELEASE_TAG }}
2150 persist-credentials : false
2251
2352 - name : Set up Python
@@ -44,24 +73,30 @@ jobs:
4473 --source-root skills --tsm "$RUNNER_TEMP/terraphim-tsm-verifier/tsm"
4574
4675 - name : Validate tagged pack
76+ id : source
4777 env :
4878 TERRAPHIM_TSM_VERIFIER : ${{ runner.temp }}/terraphim-tsm-verifier/tsm
4979 run : |
5080 expected_tag="v$(python3 scripts/generate_distribution.py --print-version)"
51- test "$GITHUB_REF_NAME " = "$expected_tag"
81+ test "$RELEASE_TAG " = "$expected_tag"
5282 # actions/checkout can leave the event tag name pointing at the
5383 # peeled commit. Fetch the remote annotated tag into a private ref so
5484 # signature verification always targets the tag object itself.
55- release_ref="refs/release-tags/$GITHUB_REF_NAME "
85+ release_ref="refs/release-tags/$RELEASE_TAG "
5686 git fetch --no-tags --force origin \
57- "refs/tags/$GITHUB_REF_NAME:$release_ref"
58- test "$(git rev-list -n 1 "$release_ref")" = "$GITHUB_SHA"
87+ "refs/tags/$RELEASE_TAG:$release_ref"
88+ test "$(git rev-list -n 1 "$release_ref")" = "$(git rev-parse HEAD)"
89+ if test "$GITHUB_EVENT_NAME" = push; then
90+ test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
91+ fi
5992 git config gpg.format ssh
6093 git config gpg.ssh.allowedSignersFile \
6194 "$GITHUB_WORKSPACE/.github/trusted-release-signers"
6295 git verify-tag "$release_ref"
6396 python3 scripts/generate_distribution.py --check
64- python3 -m unittest discover -s tests -p 'test_*.py'
97+ echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
98+ set -o pipefail
99+ python3 -m unittest discover -s tests -p 'test_*.py' 2>&1 | tee "$RUNNER_TEMP/release-tests.log"
65100
66101 - name : Rebuild and compare AutoClaw archives
67102 run : |
@@ -73,61 +108,183 @@ jobs:
73108 cmp "$archive" "$output/$name"
74109 done
75110
111+ - name : Build and admit native-qualified Cursor archive
112+ env :
113+ GH_TOKEN : ${{ github.token }}
114+ run : |
115+ python3 scripts/generate_distribution.py --cursor-dist "$RUNNER_TEMP/cursor-release" \
116+ --source-commit "$(git rev-parse HEAD)"
117+ version="$(python3 scripts/generate_distribution.py --print-version)"
118+ python3 scripts/verify_published_release.py --tag "$RELEASE_TAG" \
119+ --source-commit "$(git rev-parse HEAD)" --native-only \
120+ --cursor-archive "$RUNNER_TEMP/cursor-release/terraphim-cursor-integration-$version.zip" \
121+ --qualification-artifact-id "${QUALIFICATION_ID:-0}" \
122+ --qualification-artifact-sha256 "$QUALIFICATION_SHA256" \
123+ --receipt "$RUNNER_TEMP/native-admission.json"
124+
125+ - name : Retain release admission including failures
126+ if : always()
127+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
128+ with :
129+ name : cursor-release-admission
130+ path : |
131+ ${{ runner.temp }}/native-admission.json
132+ ${{ runner.temp }}/release-tests.log
133+ if-no-files-found : warn
134+
76135 publish :
77- needs : validate
136+ needs : [ validate, protocol-contracts]
78137 concurrency :
79- group : skills-publish-${{ github.ref }}
138+ group : skills-publish-${{ inputs.tag || github.ref }}
80139 cancel-in-progress : false
81140 runs-on : ubuntu-latest
141+ timeout-minutes : 20
82142 permissions :
83143 contents : write
144+ actions : read
84145 steps :
85146 - name : Check out validated tagged source
86147 uses : actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
87148 with :
88149 persist-credentials : false
150+ ref : ${{ needs.validate.outputs.source_commit }}
89151
90152 - name : Re-verify immutable release tag
91153 run : |
92- release_ref="refs/release-tags/$GITHUB_REF_NAME "
154+ release_ref="refs/release-tags/$RELEASE_TAG "
93155 git fetch --no-tags --force origin \
94- "refs/tags/$GITHUB_REF_NAME:$release_ref"
95- test "$(git rev-list -n 1 "$release_ref")" = "$GITHUB_SHA"
156+ "refs/tags/$RELEASE_TAG:$release_ref"
157+ test "$(git rev-list -n 1 "$release_ref")" = "$(git rev-parse HEAD)"
158+ if test "$GITHUB_EVENT_NAME" = push; then
159+ test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
160+ fi
96161 git config gpg.format ssh
97162 git config gpg.ssh.allowedSignersFile \
98163 "$GITHUB_WORKSPACE/.github/trusted-release-signers"
99164 git verify-tag "$release_ref"
100165
166+ - name : Rebuild exact qualified integration archive
167+ env :
168+ GH_TOKEN : ${{ github.token }}
169+ run : |
170+ python3 scripts/generate_distribution.py --cursor-dist "$RUNNER_TEMP/cursor-release" \
171+ --source-commit "$(git rev-parse HEAD)"
172+ version="$(python3 scripts/generate_distribution.py --print-version)"
173+ python3 scripts/verify_published_release.py --tag "$RELEASE_TAG" \
174+ --source-commit "$(git rev-parse HEAD)" --native-only \
175+ --cursor-archive "$RUNNER_TEMP/cursor-release/terraphim-cursor-integration-$version.zip" \
176+ --qualification-artifact-id "${QUALIFICATION_ID:-0}" \
177+ --qualification-artifact-sha256 "$QUALIFICATION_SHA256" \
178+ --receipt "$RUNNER_TEMP/native-admission.json" \
179+ --release-notes "$RUNNER_TEMP/cursor-release-notes.md"
180+
101181 - name : Publish immutable release assets
102182 env :
103183 GH_TOKEN : ${{ github.token }}
104184 run : |
105- if gh release view "$GITHUB_REF_NAME " --repo "$GITHUB_REPOSITORY" --json tagName; then
185+ if gh release view "$RELEASE_TAG " --repo "$GITHUB_REPOSITORY" --json tagName; then
106186 # A retry never uploads or replaces existing assets. The next step
107187 # verifies the complete immutable release against this tagged source.
108188 echo "Release already exists; verifying its published assets."
109189 else
110- gh release create "$GITHUB_REF_NAME " \
190+ gh release create "$RELEASE_TAG " \
111191 dist/autoclaw/*.zip \
112- dist/autoclaw/SHA256SUMS \
192+ "$RUNNER_TEMP"/cursor-release/*.zip \
193+ "$RUNNER_TEMP/cursor-release/SHA256SUMS" \
113194 assets/v-model-overview.svg \
114195 assets/v-model-overview.png \
115196 --repo "$GITHUB_REPOSITORY" \
116- --title "Terraphim Skills Introduction $GITHUB_REF_NAME " \
117- --generate- notes \
197+ --title "Terraphim Skills Introduction $RELEASE_TAG " \
198+ --notes-file "$RUNNER_TEMP/cursor-release- notes.md" \
118199 --verify-tag
119200 fi
120201
121202 - name : Read back every public release asset
122203 run : |
204+ version="$(python3 scripts/generate_distribution.py --print-version)"
123205 python3 scripts/verify_published_release.py \
124- --tag "$GITHUB_REF_NAME" \
206+ --tag "$RELEASE_TAG" --source-commit "$(git rev-parse HEAD)" \
207+ --cursor-archive "$RUNNER_TEMP/cursor-release/terraphim-cursor-integration-$version.zip" \
125208 --receipt "$RUNNER_TEMP/published-release.json"
126209
127210 - name : Retain actual public readback
128211 if : always()
129212 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
130213 with :
131214 name : published-release-readback
132- path : ${{ runner.temp }}/published-release.json
215+ path : |
216+ ${{ runner.temp }}/published-release.json
217+ ${{ runner.temp }}/native-admission.json
218+ ${{ runner.temp }}/cursor-release-notes.md
133219 if-no-files-found : error
220+
221+ protocol-contracts :
222+ needs : validate
223+ runs-on : ubuntu-24.04-arm
224+ timeout-minutes : 15
225+ steps :
226+ - name : Check out exact source
227+ uses : actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
228+ with :
229+ persist-credentials : false
230+ ref : ${{ needs.validate.outputs.source_commit }}
231+ - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
232+ with :
233+ python-version : " 3.12"
234+ - name : Download and admit the selected released ARM agent
235+ run : |
236+ python3 - <<'PYTHON'
237+ import hashlib, io, json, os, pathlib, tarfile, urllib.request
238+ root = pathlib.Path(os.environ['RUNNER_TEMP']) / 'cursor-protocol'
239+ root.mkdir()
240+ inputs = json.loads(pathlib.Path('integrations/cursor/release-inputs.json').read_text())
241+ assert inputs['clients']['version'] == '1.21.20'
242+ rows = [a for a in inputs['clients']['assets'] if a['tool'] == 'terraphim-agent' and a['target'] == 'aarch64-unknown-linux-musl']
243+ assert len(rows) == 1
244+ asset = rows[0]
245+ assert asset['url'] == 'https://github.com/terraphim/terraphim-clients/releases/download/v1.21.20/terraphim-agent-1.21.20-aarch64-unknown-linux-musl.tar.gz'
246+ assert asset['archiveSha256'] == 'cf09f161ff42180308509d8e9b43b66c94bedd3801987cd1112b38b3718b5789'
247+ assert asset['binarySha256'] == '5ae520c7034dd125dc6ccb0f6a2f7233794e4bef254381f292566827988f9c52'
248+ with urllib.request.urlopen(asset['url'], timeout=30) as response:
249+ raw = response.read(16 * 1024 * 1024 + 1)
250+ assert len(raw) == asset['bytes'] and hashlib.sha256(raw).hexdigest() == asset['archiveSha256']
251+ with tarfile.open(fileobj=io.BytesIO(raw), mode='r:gz') as archive:
252+ members = archive.getmembers()
253+ binaries = [m for m in members if m.name == asset['member']]
254+ assert len(binaries) == 1 and binaries[0].isfile() and binaries[0].size <= 64 * 1024 * 1024
255+ with archive.extractfile(binaries[0]) as source:
256+ binary = source.read()
257+ assert hashlib.sha256(binary).hexdigest() == asset['binarySha256']
258+ executable = root / 'terraphim-agent'
259+ executable.write_bytes(binary)
260+ executable.chmod(0o700)
261+ (root / 'input-identity.json').write_text(json.dumps(asset, indent=2) + '\n')
262+ PYTHON
263+ - name : Execute real released-agent contracts without skipped tests
264+ env :
265+ CURSOR_TEST_AGENT : ${{ runner.temp }}/cursor-protocol/terraphim-agent
266+ CURSOR_TEST_EVIDENCE : ${{ runner.temp }}/cursor-protocol/outputs
267+ run : |
268+ set -o pipefail
269+ python3 - <<'PYTHON' 2>&1 | tee "$RUNNER_TEMP/cursor-protocol/tests.log"
270+ import json, os, pathlib, sys, unittest
271+ suite = unittest.defaultTestLoader.discover('tests', pattern='test_cursor_integration.py')
272+ result = unittest.TextTestRunner(verbosity=2).run(suite)
273+ passed = result.wasSuccessful() and not result.skipped and result.testsRun > 0
274+ receipt = {'status': 'PASS' if passed else 'FAIL', 'testsRun': result.testsRun,
275+ 'skipped': len(result.skipped), 'failures': len(result.failures), 'errors': len(result.errors),
276+ 'scope': 'Real Linux ARM released-agent protocol; not native Cursor acceptance.'}
277+ pathlib.Path(os.environ['RUNNER_TEMP'], 'cursor-protocol', 'receipt.json').write_text(json.dumps(receipt, indent=2) + '\n')
278+ sys.exit(0 if passed else 1)
279+ PYTHON
280+ - name : Retain actual protocol outputs and failures
281+ if : always()
282+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
283+ with :
284+ name : cursor-protocol-contracts
285+ path : |
286+ ${{ runner.temp }}/cursor-protocol/input-identity.json
287+ ${{ runner.temp }}/cursor-protocol/outputs/
288+ ${{ runner.temp }}/cursor-protocol/tests.log
289+ ${{ runner.temp }}/cursor-protocol/receipt.json
290+ if-no-files-found : warn
0 commit comments