From 4d12a4d6cb87ac76bb3cfb87f01b2052988daa99 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 11 Oct 2025 15:05:29 -0700 Subject: [PATCH] add release channel setting and implementation --- .github/workflows/nightly-release.yml | 104 +++++++++--------- electron-builder.yml | 1 + package.json | 4 - src/i18n/locales/en.json | 4 + src/main/index.ts | 4 + .../components/window/update-settings.tsx | 41 +++++++ src/renderer/store/settings.store.ts | 2 + 7 files changed, 104 insertions(+), 56 deletions(-) diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml index c25b81f1..29d7c07c 100644 --- a/.github/workflows/nightly-release.yml +++ b/.github/workflows/nightly-release.yml @@ -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 diff --git a/electron-builder.yml b/electron-builder.yml index c3dee329..7f90ef43 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -49,3 +49,4 @@ publish: provider: github owner: jeffvli repo: feishin +generateUpdatesFilesForAllChannels: true diff --git a/package.json b/package.json index 9121f565..08665317 100644 --- a/package.json +++ b/package.json @@ -176,9 +176,5 @@ "esbuild" ] }, - "build": { - "generateUpdateFilesForAllChannels": true, - "allowDowngrade": true - }, "productName": "feishin" } diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 3666126a..2de5826c 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -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}})", diff --git a/src/main/index.ts b/src/main/index.ts index c2fed2dc..ffc898e7 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -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'; + } } } diff --git a/src/renderer/features/settings/components/window/update-settings.tsx b/src/renderer/features/settings/components/window/update-settings.tsx index 6a0bf4fc..8be829f1 100644 --- a/src/renderer/features/settings/components/window/update-settings.tsx +++ b/src/renderer/features/settings/components/window/update-settings.tsx @@ -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: ( +