Skip to content

Commit ef5dde6

Browse files
authored
Merge pull request #87 from taras/ci/tag-release
ci: spec-driven release process — maintainer tags, binaries gate packages
2 parents c74079d + 5e1e580 commit ef5dde6

26 files changed

Lines changed: 490 additions & 270 deletions

‎.github/PUBLISHING.md‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

‎.github/release-drafter.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Config for draft-release.yml — see specs/release-process-spec.md §3.
2+
name-template: "v$RESOLVED_VERSION"
3+
tag-template: "v$RESOLVED_VERSION"
4+
change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
5+
template: |
6+
## What's changed
7+
8+
$CHANGES
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Draft release
2+
3+
# Keeps a rolling draft release: every merge to main updates its changelog
4+
# with the PRs merged since the last published release. Publishing the draft
5+
# creates the tag that starts the release. See specs/release-process-spec.md.
6+
7+
on:
8+
push:
9+
branches: [main]
10+
11+
permissions:
12+
contents: write
13+
pull-requests: read
14+
15+
jobs:
16+
draft:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: release-drafter/release-drafter@4d75298e00d9e34c483e5ff8c68d0ea1c1940c1e # v7.5.1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/publish-one.yml‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Publish one package
22

3-
# Reusable: build one @executablemd workspace member with dnt and publish it to
4-
# npm (OIDC) and JSR (best-effort). publish-packages.yml calls this once per
5-
# package and orders the calls with `needs:`.
3+
# Reusable: build one @executablemd workspace member with dnt and publish it
4+
# to npm (OIDC) and JSR (best-effort). See specs/release-process-spec.md.
65

76
on:
87
workflow_call:
@@ -23,9 +22,8 @@ permissions:
2322
jobs:
2423
publish:
2524
runs-on: ubuntu-latest
26-
# Environment protection rules (required reviewers, v* tag-only deployment
27-
# rule) gate every publish; the npm trusted publisher is also bound to this
28-
# environment name, so npm rejects OIDC tokens minted outside it.
25+
# Gates every publish behind environment protection rules; the npm trusted
26+
# publisher is bound to this name (spec §4).
2927
environment: npm-publish
3028
env:
3129
# @effectionx/* peer-depend on effection `^3 || ^4`, which npm won't match
@@ -60,9 +58,7 @@ jobs:
6058
echo "build failed after 4 attempts" >&2
6159
exit 1
6260
63-
# Skip an already-published version so re-running a tag's workflow (or
64-
# tagging a version that was hand-bootstrapped) is idempotent instead of
65-
# failing on npm's no-republish rule.
61+
# Idempotent: skip a version npm already has, so tag re-runs succeed.
6662
- name: Publish to npm
6763
working-directory: ${{ inputs.package }}/npm
6864
run: |

‎.github/workflows/publish-packages.yml‎

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,16 @@
11
name: Publish packages
22

3-
# GENERATED by scripts/gen-publish-workflow.ts — do not edit by hand.
4-
# Run `deno task gen:publish-workflow` after adding/removing a workspace
5-
# package or changing its @executablemd dependencies, then commit the result.
6-
#
7-
# One tag ships everything: release.yml builds the binary; this workflow fans
8-
# out one publish-one.yml run per @executablemd package, ordered with `needs:`
9-
# so dependencies publish before dependents (leaves run in parallel).
10-
#
11-
# Prerequisites (one-time) — see .github/PUBLISHING.md:
12-
# - npm: an OIDC trusted publisher per @executablemd package. The workflow
13-
# filename npm validates is the CALLER (publish-packages.yml), not the
14-
# reusable publish-one.yml. No npm token is used.
15-
# - JSR: create/link the @executablemd packages to this repo (best-effort).
16-
#
17-
# Note for consumers: core/runtime/cli depend on effection's 4.x prerelease,
18-
# which npm's peer resolver rejects against @effectionx/* (`^3 || ^4`). Until
19-
# effection 4 is stable, installing those packages needs `--legacy-peer-deps`.
3+
# GENERATED by scripts/gen-publish-workflow.md — do not edit by hand.
4+
# Run `deno task gen:publish-workflow` and commit the result.
5+
# See specs/release-process-spec.md.
206

217
on:
228
push:
239
tags: ["v*"]
24-
workflow_dispatch:
25-
inputs:
26-
tag:
27-
description: "Tag to publish (e.g. v0.2.0)"
28-
required: true
2910

3011
permissions:
3112
contents: read
13+
actions: read # the version job polls the release.yml run
3214
id-token: write # granted to the reusable publish-one.yml jobs for OIDC
3315

3416
jobs:
@@ -37,11 +19,48 @@ jobs:
3719
outputs:
3820
value: ${{ steps.resolve.outputs.value }}
3921
steps:
22+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
23+
4024
- id: resolve
4125
run: |
42-
TAG="${{ github.event.inputs.tag || github.ref_name }}"
26+
TAG="${{ github.ref_name }}"
4327
echo "value=${TAG#v}" >> "$GITHUB_OUTPUT"
4428
29+
# Refuse a tag the manifests do not declare (spec §2).
30+
- name: Validate the manifests declare this version
31+
run: |
32+
VERSION="${{ steps.resolve.outputs.value }}"
33+
for f in durable-streams/deno.json runtime/deno.json core/deno.json cli/deno.json packages/code-review-agent/deno.json; do
34+
declared="$(jq -r .version "$f")"
35+
if [ "$declared" != "$VERSION" ]; then
36+
echo "::error::$f declares $declared, not $VERSION — the tag does not match the manifests"
37+
exit 1
38+
fi
39+
done
40+
41+
# Packages publish only after the binaries exist (spec §1): poll the
42+
# release.yml run for this commit and fail if it fails.
43+
- name: Wait for the binary release to succeed
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
for i in $(seq 1 60); do
48+
RUNS="repos/${{ github.repository }}/actions/workflows/release.yml/runs?head_sha=${{ github.sha }}&per_page=1"
49+
STATUS="$(gh api "$RUNS" --jq '.workflow_runs[0].status // "queued"')"
50+
CONCLUSION="$(gh api "$RUNS" --jq '.workflow_runs[0].conclusion // "none"')"
51+
if [ "$STATUS" = "completed" ]; then
52+
if [ "$CONCLUSION" = "success" ]; then
53+
echo "release.yml succeeded — binaries are published"
54+
exit 0
55+
fi
56+
echo "::error::release.yml concluded '$CONCLUSION' — refusing to publish packages without binaries"
57+
exit 1
58+
fi
59+
sleep 30
60+
done
61+
echo "::error::timed out waiting for release.yml"
62+
exit 1
63+
4564
durable-streams:
4665
needs: [version]
4766
uses: ./.github/workflows/publish-one.yml

‎.github/workflows/release.yml‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Release
33
on:
44
push:
55
tags: ["v*"]
6-
workflow_dispatch:
7-
inputs:
8-
tag:
9-
description: "Tag to build and release (e.g. v0.1.0)"
10-
required: true
116

127
permissions:
138
contents: write
@@ -31,12 +26,18 @@ jobs:
3126
- target: x86_64-pc-windows-msvc
3227
artifact: xmd-x86_64-pc-windows-msvc.exe
3328
steps:
34-
# For a tag push, github.ref is the tag. For workflow_dispatch, check out
35-
# the requested tag explicitly so the built revision matches the release
36-
# name (checkout fails if the tag does not exist — fail closed).
3729
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
38-
with:
39-
ref: ${{ github.event.inputs.tag || github.ref }}
30+
31+
# Refuse a tag the manifests do not declare (spec §2) — the binary's
32+
# --version comes from cli/deno.json.
33+
- name: Tag matches the manifest version
34+
run: |
35+
TAG="${{ github.ref_name }}"
36+
declared="$(jq -r .version cli/deno.json)"
37+
if [ "v$declared" != "$TAG" ]; then
38+
echo "::error::cli/deno.json declares $declared but the tag is $TAG — bump the manifests first"
39+
exit 1
40+
fi
4041
4142
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
4243
with:
@@ -78,7 +79,7 @@ jobs:
7879
- name: Publish to GitHub Release
7980
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
8081
with:
81-
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
82+
tag_name: ${{ github.ref_name }}
8283
draft: false
8384
fail_on_unmatched_files: true
8485
files: |

‎.github/workflows/repo-analysis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
# analysis behavior; bump the pin as part of each release.
3434
- name: Install xmd release binary
3535
run: |
36-
curl -fsSL https://executable.md/install.sh | XMD_VERSION=v0.2.0 sh
36+
curl -fsSL https://executable.md/install.sh | XMD_VERSION=v0.3.0 sh
3737
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
3838
3939
- name: Run repo analysis

‎.github/workflows/review.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# PR-review behavior; bump the pin as part of each release.
2020
- name: Install xmd release binary
2121
run: |
22-
curl -fsSL https://executable.md/install.sh | XMD_VERSION=v0.2.0 sh
22+
curl -fsSL https://executable.md/install.sh | XMD_VERSION=v0.3.0 sh
2323
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
2424
2525
- name: Run review

‎.reviews/ReviewPR.local.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const pr = parseDiff(rawDiff, rawFiles, {
3434
body: PR_BODY,
3535
number: PR_NUMBER,
3636
});
37+
38+
// TODO: we need an easier way to work with diffs here.
39+
const changedFilePaths = pr.files.map((file) => file.path);
3740
```
3841

3942
```bash silent exec
@@ -130,6 +133,8 @@ import { parseDiagnostics } from "@executablemd/code-review-agent";
130133
const diagnostics = parseDiagnostics(rawDiagnostics, pr, doctor);
131134
```
132135

136+
<ReleaseSpecWarning files={changedFilePaths} />
137+
133138
<ThinkFilter>
134139
<OllamaProvider model="qwen3:30b-a3b">
135140
<Instruction system="You are a precise TypeScript code review assistant. Be concise. Report only findings, not praise.">

‎.reviews/ReviewPR.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const pr = parseDiff(rawDiff, rawFiles, {
4242
body: prBody.trim(),
4343
number: PR_NUMBER,
4444
});
45+
46+
// TODO: we need an easier way to work with diffs here.
47+
const changedFilePaths = pr.files.map((file) => file.path);
4548
```
4649

4750
```bash silent exec
@@ -138,6 +141,7 @@ const diagnostics = parseDiagnostics(rawDiagnostics, pr, doctor);
138141
<DeepInfraProvider model="Qwen/Qwen3-30B-A3B">
139142
<Instruction system="You are a precise TypeScript code review assistant for the executable.md monorepo. Be concise. Report only findings, not praise.">
140143
<GitHubComment>
144+
<ReleaseSpecWarning files={changedFilePaths} />
141145
<Format>
142146
<PrPolicyReport pr={pr} diagnostics={diagnostics} doctor={doctor} />
143147
</Format>

0 commit comments

Comments
 (0)