Add R2 release publishing for stable downloads#127
Conversation
Update the release workflow to keep GitHub Release assets while also publishing versioned bundles to the release bucket and refreshing download/latest. Switch stable self-update downloads to versioned release paths, add targeted test coverage for the new URLs, and align public documentation so stable installs are described in generic terms while manual bundle downloads point to GitHub Releases.
|
Thanks for the pull request. A maintainer will review it when available. Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review. Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md |
📝 WalkthroughWalkthroughThe PR establishes a release distribution system: GitHub Actions workflow now uploads built bundles as per-architecture artifacts and publishes them to an R2/CDN bucket via a new Changes
Sequence Diagram(s)sequenceDiagram
participant Build as Build System
participant GHA as GitHub Actions
participant Artifact as Artifact Storage
participant R2 as R2/CDN
participant Client as UpdateManager
participant CDN as CDN Endpoint
Build->>GHA: Build release bundles per architecture
GHA->>Artifact: Upload artifacts (release-bundle-linux-*)
GHA->>R2: Run publish_release.sh
R2->>R2: Discover tarballs & checksums
R2->>R2: Upload to bucket with versioning
R2->>R2: Create 'latest' version pointer
R2->>CDN: HTTP validation checks
CDN-->>R2: Confirm all URLs accessible
R2->>GHA: Report to step summary
Client->>Client: Call get_release_download_url()
Client->>CDN: Construct versioned URL<br/>(releases/0.3.0/)
CDN-->>Client: Serve release bundle
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request description looks incomplete. Please update the missing sections below before review. Missing items:
|
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (1)
src/aish/cli/update_manager.py (1)
85-89: Harden tag handling in URL builder with existing normalizer.Line 87 strips a leading
vbut doesn’t validate input shape. Reusingnormalize_tag()here keeps tag parsing consistent for all callers and avoids malformed release paths.Suggested patch
def get_release_download_url(self, tag_name: str, filename: str) -> str: """Resolve the CDN URL for a versioned release artifact.""" - version_str = tag_name.lstrip("v") + normalized_tag = self.normalize_tag(tag_name) + version_str = normalized_tag.lstrip("v") return f"{self.get_download_base_url()}/releases/{version_str}/{filename}"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/aish/cli/update_manager.py` around lines 85 - 89, The URL builder get_release_download_url currently only strips a leading "v" from tag_name which can produce inconsistent or malformed paths; update get_release_download_url to call the existing normalize_tag(tag_name) to obtain a validated, normalized version string before building the path, then use that normalized value in the f"{self.get_download_base_url()}/releases/{version}/{filename}" construction; reference normalize_tag and get_release_download_url so reviewers can find and verify the fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packaging/scripts/publish_release.sh`:
- Around line 69-81: The current validation loop only checks HTTP status; update
the validation to specially verify the "latest" entry in validated_urls returns
the expected VERSION and retry a few times if it doesn't. Modify the logic
around validated_urls/for url in "${validated_urls[@]}" to detect when url ends
with "/latest" (or compare against
"${CDN_BASE_URL%/}/${DOWNLOAD_PREFIX}/latest"), perform a body fetch (curl -fsS
with timeouts) and assert the response contains the ${VERSION} string (with a
small retry loop, e.g., 3 attempts and short sleep between attempts) before
treating it as valid; keep the existing status-only check for artifact release
URLs. Ensure failures still cause a non-zero exit.
In `@README_CN.md`:
- Line 124: The README_CN has inconsistent wording about download source: the
sentence in the "快速开始方式二" section still refers to “官方发布目录” while Line 124
describes parsing the “最新稳定版本” and downloading matching bundle from GitHub
Releases; update the "快速开始方式二" text to match the new approach by replacing
“官方发布目录” (or any equivalent phrasing) with a clear reference to downloading the
matching bundle from the GitHub Releases assets (e.g. “从对应版本的 GitHub Releases
资产下载最新稳定版本的 bundle”), and ensure the brief installer description and the
quick-start step use the same phrasing.
In `@README_DE.md`:
- Line 129: Die Schnellstart-Sektion verwendet noch die Formulierung
"offiziellen Release-Verzeichnis" und muss mit der aktualisierten
Line-129-Formulierung über GitHub-Release-Assets pro Version abgeglichen werden;
ersetze in der Schnellstart-Paragraph (Schnellstart, bisherige Formulierung
"offiziellen Release-Verzeichnis") den Text so dass er dieselbe Aussage wie die
Line-129-Satzstruktur verwendet (z. B. "GitHub‑Release‑Assets pro Version") und
prüfe auf konsistente Begriffe für Installer, Bundle und die Zielpfade
(`/usr/local/bin`, `aish`, `aish-sandbox`, `aish-uninstall`) im gesamten
README_DE.md.
In `@README_ES.md`:
- Line 129: Unificar la redacción sobre la fuente del bundle en README_ES.md:
reemplaza la mención "directorio oficial de releases" en la sección "Inicio
rápido" (encuentra el encabezado Inicio rápido) por "assets de GitHub Releases
por versión" para que coincida con la frase ya actualizada en la línea que
describe el instalador (la oración que dice que el instalador descarga el bundle
correspondiente para tu arquitectura e instala `aish`, `aish-sandbox` y
`aish-uninstall`), asegurándote de usar la misma terminología exacta en ambos
lugares para evitar ambigüedades.
In `@README_FR.md`:
- Line 129: Mettre à jour le texte de l’Option 2 dans README_FR.md (la section
"Option 2" du démarrage rapide) pour remplacer la mention "répertoire officiel
des releases" par une référence cohérente aux assets GitHub Releases par
version, en reprenant la même formulation utilisée à la ligne décrivant
l’installeur (qui mentionne le téléchargement des assets par architecture) afin
d’harmoniser les instructions de téléchargement manuel.
In `@README_JA.md`:
- Line 129: Update the Quick Start Option 2 text in README_JA.md to match the
new manual-install guidance: replace the phrase referencing the “official
release directory” and any instructions that point users to that location with
instructions to download the appropriate bundle from the GitHub Release assets
for the desired version (same approach used in the updated line that references
installing `aish`, `aish-sandbox`, and `aish-uninstall` into `/usr/local/bin`).
Ensure the wording explicitly instructs selecting the correct
architecture-specific asset for the chosen version and mirrors the
language/format used in the already-updated sentence about resolving the latest
stable release and installing the binaries.
In `@README.md`:
- Line 129: Update the README so both the installer description and Quick Start
Option 2 consistently point to GitHub Release assets rather than the “official
release directory”: change the text in the installer sentence that mentions
resolving the latest stable version and the Quick Start Option 2 instructions
that reference the “official release directory” to instead reference downloading
the matching bundle from the GitHub Releases assets (and ensure any curl/wget
examples, download URLs, and wording around “stable-version” reflect the GitHub
Releases approach). Use the exact section header "Quick Start Option 2" and the
installer sentence mentioning `aish`, `aish-sandbox`, and `aish-uninstall` to
locate and update the two places.
In `@tests/test_update_manager.py`:
- Around line 154-157: The test asserts a malformed duplicated
"/releases/releases/" path in stream_url; fix the URL-construction to normalize
AISH_DOWNLOAD_BASE_URL before joining so duplicate "/releases" or trailing
slashes are removed (trim any trailing "/releases" or "/" from the base) in the
function that builds stream_url (e.g., the UpdateManager method that constructs
the download URL or helper that returns stream_url), then update the test
assertion to expect a single "/releases/<version>/..." segment (use the
stream_url variable assertion).
---
Nitpick comments:
In `@src/aish/cli/update_manager.py`:
- Around line 85-89: The URL builder get_release_download_url currently only
strips a leading "v" from tag_name which can produce inconsistent or malformed
paths; update get_release_download_url to call the existing
normalize_tag(tag_name) to obtain a validated, normalized version string before
building the path, then use that normalized value in the
f"{self.get_download_base_url()}/releases/{version}/{filename}" construction;
reference normalize_tag and get_release_download_url so reviewers can find and
verify the fix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 10f1e5ab-f68d-4b9d-adc9-94712eca7287
📒 Files selected for processing (11)
.github/workflows/release.ymlQUICKSTART.mdREADME.mdREADME_CN.mdREADME_DE.mdREADME_ES.mdREADME_FR.mdREADME_JA.mdpackaging/scripts/publish_release.shsrc/aish/cli/update_manager.pytests/test_update_manager.py
Summary
This PR keeps GitHub Release assets as part of the release flow while also publishing stable release bundles to the R2-backed download bucket.
It moves stable self-update downloads to versioned release paths, adds a dedicated publish step that refreshes
download/latest, and updates public install documentation so stable installs are described in generic product terms while manual bundle downloads point to GitHub Releases.What Changed
.github/workflows/release.ymlto:publish-release-bundlesjob gated by thereleaseenvironmentdownload/latestpackaging/scripts/publish_release.shto:.sha256files todownload/releases/<version>/download/latestsrc/aish/cli/update_manager.pyso stable downloads resolve throughdownload/releases/<version>/...instead of the old flat pathtests/test_update_manager.pyto cover the versioned stable download URLs and the download-base override behaviorREADME*.mdandQUICKSTART.mdcopy in this repo so:Why
The stable install and self-update flows now depend on a
download/latestmetadata file plus versioned release artifact directories. The release pipeline has to publish those objects automatically, otherwise stable installs and updates would keep depending on the old flat release layout.Validation
/home/lixin/workspace/aishell/aish/.venv/bin/python -m pytest tests/test_update_manager.py -k download_release -qbash -n /home/lixin/workspace/aishell/aish/packaging/scripts/publish_release.shNotes
aishrepository itself.Summary by CodeRabbit
Release Notes
Documentation
New Features