Skip to content
Merged
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
24 changes: 17 additions & 7 deletions .github/workflows/release-tauri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
build:
permissions:
contents: write
# 渠道由 tag 后缀决定:
# v<v>-beta-tauri → beta 渠道(GitHub Release 标 prerelease,
# manifest 文件名带 -beta 后缀,正式版用户的 endpoint 拿不到)
# v<v>-tauri → stable 渠道(正式版,文件名沿用旧约定,向后兼容)
# workflow_dispatch / 非 tag 触发时 github.ref_name 不是 tag 字符串,
# endsWith 返回 false,回退为 stable,不改变现有 dispatch 行为。
env:
OPENLESS_RELEASE_CHANNEL: ${{ endsWith(github.ref_name, '-beta-tauri') && 'beta' || 'stable' }}
Comment on lines +33 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Merge the channel into the existing job env

This adds a second env: mapping under the same jobs.build object, while the workflow already has another job-level env below runs-on for the Tauri signing secrets. YAML cannot keep both mappings for the same key (parsers either reject the workflow or keep only one; e.g. the later block drops this OPENLESS_RELEASE_CHANNEL value), so a v*-beta-tauri run will not propagate beta to the manifest step and prerelease evaluates false. Put this variable into the existing job env block instead.

Useful? React with 👍 / 👎.

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -370,6 +378,8 @@ jobs:
OPENLESS_UPDATE_ARCH: ${{ matrix.updater-arch }}
OPENLESS_UPDATE_REPO: appergb/openless
OPENLESS_UPDATE_MIRROR_BASE_URL: https://fastgit.cc/https://github.com
# beta 渠道时输出 latest-{tgt}-{arch}-beta.json,stable 沿用旧文件名。
OPENLESS_RELEASE_CHANNEL: ${{ env.OPENLESS_RELEASE_CHANNEL }}
run: node scripts/write-updater-manifest.mjs

# ── 收集产物 ──
Expand Down Expand Up @@ -413,8 +423,7 @@ jobs:
path: |
openless-all/app/src-tauri/target/release/bundle/macos/*.app.tar.gz
openless-all/app/src-tauri/target/release/bundle/macos/*.app.tar.gz.sig
openless-all/app/src-tauri/target/release/bundle/latest-darwin-${{ matrix.updater-arch }}.json
openless-all/app/src-tauri/target/release/bundle/latest-darwin-${{ matrix.updater-arch }}-mirror.json
openless-all/app/src-tauri/target/release/bundle/latest-darwin-${{ matrix.updater-arch }}*.json
if-no-files-found: error

- name: Upload Windows artifacts
Expand All @@ -435,8 +444,7 @@ jobs:
path: |
openless-all/app/src-tauri/target/release/bundle/nsis/*.exe.sig
openless-all/app/src-tauri/target/release/bundle/msi/*.msi.sig
openless-all/app/src-tauri/target/release/bundle/latest-windows-x86_64.json
openless-all/app/src-tauri/target/release/bundle/latest-windows-x86_64-mirror.json
openless-all/app/src-tauri/target/release/bundle/latest-windows-x86_64*.json
if-no-files-found: error

- name: Upload Linux artifacts
Expand All @@ -457,8 +465,7 @@ jobs:
name: openless-linux-x64-updater
path: |
openless-all/app/src-tauri/target/release/bundle/appimage/*.AppImage.sig
openless-all/app/src-tauri/target/release/bundle/latest-linux-x86_64.json
openless-all/app/src-tauri/target/release/bundle/latest-linux-x86_64-mirror.json
openless-all/app/src-tauri/target/release/bundle/latest-linux-x86_64*.json
if-no-files-found: error

# ── tag 推送时,同步上传到 GitHub Release ──
Expand All @@ -469,7 +476,10 @@ jobs:
tag_name: ${{ github.ref_name }}
name: 'OpenLess ${{ github.ref_name }}'
draft: false
prerelease: false
# beta 渠道的 release 必须标 prerelease=true:GitHub UI 会折叠它,
# 普通用户看不到;同时只上传 latest-*-beta.json,正式版用户的
# endpoint(latest-*.json)永远不会被覆盖,保证 Beta 不溢出正式版。
prerelease: ${{ env.OPENLESS_RELEASE_CHANNEL == 'beta' }}
# Matrix jobs all upload assets to the same release. Generate notes once
# so macOS, Windows, and Linux jobs do not duplicate the release body.
generate_release_notes: ${{ matrix.updater-target == 'darwin' && matrix.updater-arch == 'aarch64' }}
Expand Down
11 changes: 9 additions & 2 deletions openless-all/app/scripts/write-updater-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ const target = process.env.OPENLESS_UPDATE_TARGET;
const arch = process.env.OPENLESS_UPDATE_ARCH;
const repo = process.env.OPENLESS_UPDATE_REPO || 'appergb/openless';
const mirrorBaseUrl = process.env.OPENLESS_UPDATE_MIRROR_BASE_URL || 'https://fastgit.cc/https://github.com';
// 渠道决定 manifest 文件名后缀:stable → 旧文件名(向后兼容);beta → 加 -beta 后缀,
// 让 stable 用户的 endpoint 永远拿不到 beta 包。空 / 未设置 = stable。
const rawChannel = (process.env.OPENLESS_RELEASE_CHANNEL || 'stable').toLowerCase();
if (rawChannel !== 'stable' && rawChannel !== 'beta') {
throw new Error(`Invalid OPENLESS_RELEASE_CHANNEL: "${rawChannel}" (expected "stable" or "beta")`);
}
const channelSuffix = rawChannel === 'beta' ? '-beta' : '';

if (!target || !arch) {
throw new Error('OPENLESS_UPDATE_TARGET and OPENLESS_UPDATE_ARCH are required');
Expand Down Expand Up @@ -55,8 +62,8 @@ if (!existsSync(signaturePath)) {
}

const assetName = basename(artifact);
const manifestName = `latest-${target}-${arch}.json`;
const mirrorManifestName = `latest-${target}-${arch}-mirror.json`;
const manifestName = `latest-${target}-${arch}${channelSuffix}.json`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid releases/latest for beta manifests

When channelSuffix is -beta, this creates a manifest intended to live on a GitHub prerelease, but the url written just below still uses /releases/latest/download/.... GitHub's latest download route resolves to the latest non-prerelease release, so a beta manifest fetched from a prerelease would point users at the stable asset (and a beta endpoint using latest/download/latest-...-beta.json would not find the prerelease manifest). Beta artifacts need tag-specific or otherwise beta-specific download URLs instead of the global latest route.

Useful? React with 👍 / 👎.

const mirrorManifestName = `latest-${target}-${arch}${channelSuffix}-mirror.json`;
const githubAssetUrl = `https://github.com/${repo}/releases/latest/download/${assetName}`;
const mirrorAssetUrl = `${mirrorBaseUrl.replace(/\/$/, '')}/${repo}/releases/latest/download/${assetName}`;
const manifest = {
Expand Down