add release channel setting and implementation

This commit is contained in:
jeffvli 2025-10-11 15:05:29 -07:00
parent f14d1f3c5c
commit 4d12a4d6cb
7 changed files with 104 additions and 56 deletions

View file

@ -52,58 +52,58 @@ jobs:
Write-Host "Updated package.json version to: $newVersion"
# - name: Build and Publish releases (Windows)
# if: matrix.os == 'windows-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:win
# pnpm run publish:win
# on_retry_command: pnpm cache delete
- name: Build and Publish releases (Windows)
if: matrix.os == 'windows-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:win
pnpm run publish:win
on_retry_command: pnpm cache delete
# - name: Build and Publish releases (macOS)
# if: matrix.os == 'macos-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:mac
# pnpm run publish:mac
# on_retry_command: pnpm cache delete
- name: Build and Publish releases (macOS)
if: matrix.os == 'macos-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:mac
pnpm run publish:mac
on_retry_command: pnpm cache delete
# - name: Build and Publish releases (Linux)
# if: matrix.os == 'ubuntu-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:linux
# pnpm run publish:linux
# on_retry_command: pnpm cache delete
- name: Build and Publish releases (Linux)
if: matrix.os == 'ubuntu-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:linux
pnpm run publish:linux
on_retry_command: pnpm cache delete
# - name: Build and Publish releases (Linux ARM64)
# if: matrix.os == 'ubuntu-latest'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: nick-invision/retry@v2.8.2
# with:
# timeout_minutes: 30
# max_attempts: 3
# retry_on: error
# command: |
# pnpm run package:linux-arm64
# pnpm run publish:linux-arm64
# on_retry_command: pnpm cache delete
- name: Build and Publish releases (Linux ARM64)
if: matrix.os == 'ubuntu-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:linux-arm64
pnpm run publish:linux-arm64
on_retry_command: pnpm cache delete

View file

@ -49,3 +49,4 @@ publish:
provider: github
owner: jeffvli
repo: feishin
generateUpdatesFilesForAllChannels: true

View file

@ -176,9 +176,5 @@
"esbuild"
]
},
"build": {
"generateUpdateFilesForAllChannels": true,
"allowDowngrade": true
},
"productName": "feishin"
}

View file

@ -530,6 +530,10 @@
"customFontPath": "custom font path",
"customFontPath_description": "sets the path to the custom font to use for the application",
"disableAutomaticUpdates": "disable automatic updates",
"releaseChannel_optionLatest": "latest",
"releaseChannel_optionBeta": "beta",
"releaseChannel": "release channel",
"releaseChannel_description": "choose between stable releases or beta releases for automatic updates",
"disableLibraryUpdateOnStartup": "disable checking for new versions on startup",
"discordApplicationId": "{{discord}} application id",
"discordApplicationId_description": "the application id for {{discord}} rich presence (defaults to {{defaultId}})",

View file

@ -44,6 +44,10 @@ export default class AppUpdater {
log.transports.file.level = 'info';
autoUpdater.logger = autoUpdaterLogInterface;
autoUpdater.checkForUpdatesAndNotify();
if (store.get('release_channel') === 'beta') {
autoUpdater.channel = 'beta';
}
}
}

View file

@ -6,6 +6,7 @@ import {
SettingsSection,
} from '/@/renderer/features/settings/components/settings-section';
import { useSettingsStoreActions, useWindowSettings } from '/@/renderer/store';
import { Select } from '/@/shared/components/select/select';
import { Switch } from '/@/shared/components/switch/switch';
const localSettings = isElectron() ? window.api.localSettings : null;
@ -17,6 +18,46 @@ export const UpdateSettings = () => {
const { setSettings } = useSettingsStoreActions();
const updateOptions: SettingOption[] = [
{
control: (
<Select
data={[
{
label: t('setting.releaseChannel', {
context: 'optionLatest',
postProcess: 'titleCase',
}),
value: 'latest',
},
{
label: t('setting.releaseChannel', {
context: 'optionBeta',
postProcess: 'titleCase',
}),
value: 'beta',
},
]}
defaultValue={'latest'}
onChange={(value) => {
if (!value) return;
localSettings?.set('release_channel', value);
setSettings({
window: {
...settings,
releaseChannel: value as 'beta' | 'latest',
},
});
}}
value={settings.releaseChannel}
/>
),
description: t('setting.releaseChannel', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
title: t('setting.releaseChannel', { postProcess: 'sentenceCase' }),
},
{
control: (
<Switch

View file

@ -333,6 +333,7 @@ export interface SettingsState {
exitToTray: boolean;
minimizeToTray: boolean;
preventSleepOnPlayback: boolean;
releaseChannel: 'beta' | 'latest';
startMinimized: boolean;
tray: boolean;
windowBarStyle: Platform;
@ -682,6 +683,7 @@ const initialState: SettingsState = {
exitToTray: false,
minimizeToTray: false,
preventSleepOnPlayback: false,
releaseChannel: 'latest',
startMinimized: false,
tray: true,
windowBarStyle: platformDefaultWindowBarStyle,