-
Notifications
You must be signed in to change notification settings - Fork 3
182 lines (164 loc) · 6.06 KB
/
release.yml
File metadata and controls
182 lines (164 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
triple: linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
triple: linux-aarch64
- target: x86_64-apple-darwin
os: macos-latest
triple: darwin-x86_64
- target: aarch64-apple-darwin
os: macos-latest
triple: darwin-aarch64
steps:
- uses: actions/checkout@v4
- name: Clone agentic-sdk (sibling dependency)
run: git clone --depth 1 https://github.com/agentralabs/agentic-sdk.git ../agentic-sdk
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --workspace --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Strip binary
run: |
strip target/${{ matrix.target }}/release/acb || true
strip target/${{ matrix.target }}/release/agentic-codebase-mcp || true
- name: Package
run: |
VERSION="${GITHUB_REF_NAME#v}"
ASSET="agentic-codebase-${VERSION}-${{ matrix.triple }}"
mkdir -p "${ASSET}"
cp target/${{ matrix.target }}/release/acb "${ASSET}/"
cp target/${{ matrix.target }}/release/agentic-codebase-mcp "${ASSET}/"
tar czf "${ASSET}.tar.gz" "${ASSET}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: agentic-codebase-${{ matrix.triple }}
path: "*.tar.gz"
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Validate release note file
id: note
shell: bash
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
NOTE_FILE="release-notes/v${VERSION}.md"
if [ ! -f "${NOTE_FILE}" ]; then
echo "Missing required release note: ${NOTE_FILE}"
exit 1
fi
python3 - <<'PY' "${NOTE_FILE}"
import re
import sys
from pathlib import Path
path = Path(sys.argv[1])
text = path.read_text(encoding="utf-8")
required = [
"## Executive Summary",
"## Business Impact",
"## Rollout Guidance",
"## Source Links",
]
for heading in required:
if heading not in text:
raise SystemExit(f"Missing required heading: {heading}")
if "template_draft" in text.lower():
raise SystemExit("Template marker still present in release notes.")
if "as an ai" in text.lower():
raise SystemExit("Release notes contain forbidden phrasing: as an ai")
paragraphs = []
for block in re.split(r"\n\s*\n", text):
b = block.strip()
if not b or b.startswith("##") or b.startswith("- "):
continue
paragraphs.append(b)
if len(paragraphs) < 3:
raise SystemExit("Release note must contain at least 3 narrative paragraphs.")
for idx, p in enumerate(paragraphs[:3], start=1):
if len(p) < 120:
raise SystemExit(f"Paragraph {idx} too short ({len(p)} chars).")
PY
echo "file=${NOTE_FILE}" >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*.tar.gz
body_path: ${{ steps.note.outputs.file }}
generate_release_notes: false
draft: false
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') }}
publish-crate:
name: Publish to crates.io (core + ffi + mcp + cli)
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clone agentic-sdk (sibling dependency)
run: git clone --depth 1 https://github.com/agentralabs/agentic-sdk.git ../agentic-sdk
- uses: dtolnay/rust-toolchain@stable
- name: Publish crates in canonical order
shell: bash
run: |
set -euo pipefail
publish_crate() {
local pkg="$1"
local retries="${2:-12}"
local attempt
local output
for attempt in $(seq 1 "$retries"); do
echo "Publish attempt ${attempt}/${retries} for ${pkg}..."
if output="$(cargo publish -p "${pkg}" --token "${{ secrets.CARGO_REGISTRY_TOKEN }}" 2>&1)"; then
echo "$output"
return 0
fi
echo "$output"
if echo "$output" | grep -Eqi "already uploaded|already exists on crates\\.io index"; then
echo "${pkg} already published for this version; continuing."
return 0
fi
if echo "$output" | grep -Eqi "failed to select a version for the requirement|no matching package named|could not find .* in registry"; then
echo "Dependency index propagation not ready yet; waiting before retry..."
sleep 20
continue
fi
return 1
done
echo "Timed out waiting for crates.io index propagation for ${pkg}."
return 1
}
publish_crate "agentic-codebase"
publish_crate "agentic-codebase-ffi"
publish_crate "agentic-codebase-mcp"
publish_crate "agentic-codebase-cli"