Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 57 additions & 19 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,37 +170,75 @@ The script takes a plain `X.Y.Z`; for a prerelease version such as
Do not rerun an asset workflow after publication without first returning the release to draft.

The workflows also write the channel updater manifests (`latest-{target}-{arch}.json` and
`latest-{target}-{arch}-beta.json`) but deliberately keep them **out** of the release assets —
current clients read the CDN, not the release. Download them from the run and publish them to
the CDN as part of publishing the release:
`latest-{target}-{arch}-beta.json`) but deliberately keep them **out** of the release assets.
Current clients read those manifests from Aliyun, not from the GitHub Release. Download the
manifest artifacts from the run. Uploading them is only half of the Aliyun step: the binary
packages named by those manifests must be uploaded to Aliyun as well. See
[Aliyun artifacts](#aliyun-artifacts) below. Clients built before the CDN switch read the old
`releases/latest/download/latest-*.json` assets, which new releases no longer carry, so they
need one manual download.
7. Publishing Stable with the administrator's CLI/UI credential automatically
triggers `sync-homebrew-cask.yml`. It accepts only the published latest Stable
tag, preserves application build metadata in DMG filenames, verifies matching
ARM/Intel versions, computes their checksums and commits the cask update.
Drafts, Beta and older releases never update Homebrew. If repair is needed, run
`gh workflow run sync-homebrew-cask.yml -f tag=v<version>-tauri`; no asset rebuild
or manual cask edit is needed. Do not publish via an asset workflow's
`GITHUB_TOKEN`, which does not emit the downstream release event.

## Aliyun artifacts

阿里云这里要上传二进制产物。客户端先向阿里云要文件;阿里云能拉到就从阿里云下载,因为这条链路更快;阿里云没有拉到就改从 GitHub 下载同一份产物。

Aliyun here is `https://dl.aeoform.com` (ESA). A published GitHub Release does not put anything
on Aliyun. After the tag workflows succeed, upload both of the following.

1. **Binary artifacts.** Upload every updater package the manifest will name, byte-for-byte the
same object as the GitHub Release asset:

```text
https://dl.aeoform.com/releases/{tag}/{asset}
```

This includes the macOS `OpenLess_{arch}.app.tar.gz` archives, the Windows
`*-setup.exe`, and the Android APKs. Website alias installers (`OpenLess_macos_aarch64.dmg`
and the other short names) belong at the same prefix when those URLs are handed out.
`.sig` files are not a separate client download; the signature stays inside the manifest.
Do not stop after uploading the JSON. An Aliyun manifest that points at a missing object
makes the download 404.

2. **Rolling manifests.** Download these from the workflow artifacts and overwrite them in
place. The file name is per platform and channel, never per version.

| platform | workflow artifact |
| --- | --- |
| macOS | `openless-macos-<arch>-updater` |
| Windows | `openless-windows-x64-updater` |
| Android | `openless-android-updater-manifests` |

Destination (overwrite in place; the file name is per platform and channel, never per
version):

```text
https://dl.aeoform.com/updates/stable/latest-{target}-{arch}.json
https://dl.aeoform.com/updates/beta/latest-{target}-{arch}-beta.json
```

Their `url` fields must point at the CDN artifacts (`.../releases/{tag}/{asset}`).
Manifest upload is the step that makes a release reachable by auto-update: a published
release whose manifests were not synced is downloadable by hand but invisible to the updater.
Clients built before the CDN switch read the old `releases/latest/download/latest-*.json`
assets, which new releases no longer carry, so they need one manual download.
7. Publishing Stable with the administrator's CLI/UI credential automatically
triggers `sync-homebrew-cask.yml`. It accepts only the published latest Stable
tag, preserves application build metadata in DMG filenames, verifies matching
ARM/Intel versions, computes their checksums and commits the cask update.
Drafts, Beta and older releases never update Homebrew. If repair is needed, run
`gh workflow run sync-homebrew-cask.yml -f tag=v<version>-tauri`; no asset rebuild
or manual cask edit is needed. Do not publish via an asset workflow's
`GITHUB_TOKEN`, which does not emit the downstream release event.
The manifest `url` must stay the Aliyun object (`.../releases/{tag}/{asset}`). Do not write
the GitHub URL into the manifest. There is no GitHub copy of this JSON. If the previous
JSON is still what clients receive after the overwrite, purge that JSON path on Aliyun.

**Client order.** Builds that contain the fallback ask Aliyun for the binary first. When Aliyun
returns the object, the download stays on Aliyun because that path is faster. When Aliyun does
not serve it (the object is missing, the response is not successful, or the request fails), the
client downloads the same `{tag}/{asset}` from:

```text
https://github.com/Open-Less/openless/releases/download/{tag}/{asset}
```

The minisign signature still has to match those bytes. Clients installed before this fallback
only know the Aliyun URL. For those installs, both the rolling JSON and the binary have to be
on Aliyun. A JSON file that still names the previous version makes the in-app check report
"already current" and never starts a download. Uploading the binaries alone does not change
that.

Before dispatching the Linux release build, additionally require all of the following:

Expand Down
5 changes: 3 additions & 2 deletions openless-all/app/src-tauri/src/android/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ mod android_impl {

pub async fn check_update(channel: UpdateChannel) -> Result<Option<AppUpdateMetadata>, String> {
let arch = device_arch()?;
// Manifests live on the project CDN; channel is a URL path, not a filename suffix, so
// there is no tag discovery and no GitHub dependency (see `crate::update_source`).
// The rolling manifest stays on Aliyun. Channel is a URL path, not a filename suffix.
// Binary fallback to GitHub happens in the download command, after this check returns
// the manifest `url` (see `crate::update_source`).
let url = crate::update_source::manifest_url(channel, "android", arch);
let current = env!("CARGO_PKG_VERSION").to_string();
match fetch_manifest(&url).await {
Expand Down
33 changes: 23 additions & 10 deletions openless-all/app/src-tauri/src/commands/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,12 @@ fn extract_between(haystack: &str, open: &str, close: &str) -> Option<String> {
// - Beta channel: swap in `https://dl.aeoform.com/updates/beta/...-beta.json` through
// builder.endpoints(vec![url])?.build()?.check().
//
// Manifests live on the project CDN instead of the GitHub Release assets (see
// `crate::update_source`), so a release no longer accumulates fourteen `latest-*.json` copies.
// The channel split is now a URL *path* (`/updates/stable/` vs `/updates/beta/`) instead of a
// filename suffix, and artifact URLs inside the manifest point at the same CDN — a Stable
// client can never reach a Beta package, and mainland-China downloads never touch github.com.
// Manifests live on Aliyun instead of the GitHub Release assets (see `crate::update_source`),
// so a release no longer accumulates fourteen `latest-*.json` copies. The channel split is a
// URL path (`/updates/stable/` vs `/updates/beta/`). The manifest `url` names the Aliyun
// object at `/releases/{tag}/{asset}`. Before this check hands the plugin an `Update`, it
// probes that object: Aliyun is used when the probe succeeds, and the same asset is taken
// from GitHub when Aliyun does not serve it. A Stable manifest still cannot name a Beta path.
//
// The returned Metadata shape exactly matches plugin-updater's JS UpdateMetadata (rid +
// currentVersion and other camelCase fields), so the frontend can call
Expand Down Expand Up @@ -796,9 +797,20 @@ pub async fn app_check_update_with_channel<R: tauri::Runtime>(
.await
.map_err(|e| format!("check update failed: {e}"))?;

let Some(update) = update else {
let Some(mut update) = update else {
return Ok(None);
};
// The plugin downloads `Update.download_url` and ignores a later change to the JS copy.
// Choose Aliyun or GitHub before the resource is stored.
let chosen =
crate::update_source::resolve_artifact_download_url(update.download_url.as_str()).await;
if chosen != update.download_url.as_str() {
update.download_url =
url::Url::parse(&chosen).map_err(|e| format!("parse artifact fallback url: {e}"))?;
if let Some(object) = update.raw_json.as_object_mut() {
object.insert("url".to_string(), serde_json::Value::String(chosen));
}
}
// Passing through the date field would require the time crate; the frontend
// AutoUpdate.tsx never uses date, so set it to None here and avoid pulling a new dep
// into src-tauri/Cargo.toml.
Expand All @@ -816,8 +828,8 @@ pub async fn app_check_update_with_channel<R: tauri::Runtime>(
/// The Beta manifest endpoint, with `{{target}}` / `{{arch}}` left in place for
/// `tauri-plugin-updater` to substitute at check time.
///
/// Beta is a URL *path* on the CDN (`/updates/beta/`), so there is no tag discovery step and
/// no dependency on `releases.atom` or the GitHub Release assets.
/// Beta is a URL path on Aliyun (`/updates/beta/`). Tag discovery is not required. The
/// manifest JSON is not read from GitHub; only a missing Aliyun binary falls back there.
#[cfg(not(mobile))]
fn beta_manifest_endpoint() -> Result<url::Url, String> {
let template = crate::update_source::endpoint_template(UpdateChannel::Beta);
Expand Down Expand Up @@ -875,8 +887,9 @@ pub async fn app_download_and_install_android_update(
signature: String,
version: String,
) -> Result<(), String> {
// Parse and validate the host before downloading so userinfo and hostname-prefix tricks
// cannot turn the signed update fetch into an SSRF primitive.
// Prefer the Aliyun object. When that probe does not succeed, use the GitHub asset of
// the same tag and name, then reject anything outside the release-host allowlist.
let url = crate::update_source::resolve_artifact_download_url(&url).await;
if !is_allowed_android_update_url(&url) {
return Err(format!("不信任的更新 URL,拒绝下载: {url}"));
}
Expand Down
Loading
Loading