From 7782bb1ba547b570b8f95a02bf20712f68e3d0df Mon Sep 17 00:00:00 2001 From: hampus-fluxer Date: Sat, 3 Jan 2026 17:30:08 +0100 Subject: [PATCH] fix(app): reconcile electron builder configs (#11) --- .github/workflows/build-desktop.yaml | 26 +++- fluxer_app/electron-builder.canary.yaml | 114 ------------------ fluxer_app/electron-builder.config.cjs | 153 ++++++++++++++++++++++++ fluxer_app/electron-builder.yaml | 114 ------------------ 4 files changed, 176 insertions(+), 231 deletions(-) delete mode 100644 fluxer_app/electron-builder.canary.yaml create mode 100644 fluxer_app/electron-builder.config.cjs delete mode 100644 fluxer_app/electron-builder.yaml diff --git a/.github/workflows/build-desktop.yaml b/.github/workflows/build-desktop.yaml index 23a4faed..7fa0717f 100644 --- a/.github/workflows/build-desktop.yaml +++ b/.github/workflows/build-desktop.yaml @@ -278,7 +278,27 @@ jobs: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: pnpm exec electron-builder --config electron-builder.yaml --mac --${{ matrix.electron_arch }} + run: pnpm exec electron-builder --config electron-builder.config.cjs --mac --${{ matrix.electron_arch }} + + - name: Verify macOS bundle ID (fail fast if wrong channel) + if: matrix.platform == 'macos' + working-directory: ${{ env.APP_WORKDIR }} + shell: bash + env: + BUILD_CHANNEL: ${{ env.BUILD_CHANNEL }} + run: | + set -euo pipefail + DIST="dist-electron" + ZIP="$(ls -1 "$DIST"/*"${{ matrix.electron_arch }}"*.zip | head -n1)" + tmp="$(mktemp -d)" + ditto -xk "$ZIP" "$tmp" + APP="$(find "$tmp" -maxdepth 2 -name "*.app" -print -quit)" + BID=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP/Contents/Info.plist") + + expected="app.fluxer" + if [[ "${BUILD_CHANNEL:-stable}" == "canary" ]]; then expected="app.fluxer.canary"; fi + echo "Bundle id in zip: $BID (expected: $expected)" + test "$BID" = "$expected" - name: Build Electron app (Windows) if: matrix.platform == 'windows' @@ -289,7 +309,7 @@ jobs: TMP: C:\t SQUIRREL_TEMP: C:\sq ELECTRON_BUILDER_CACHE: C:\ebcache - run: pnpm exec electron-builder --config electron-builder.yaml --win --${{ matrix.electron_arch }} + run: pnpm exec electron-builder --config electron-builder.config.cjs --win --${{ matrix.electron_arch }} - name: Analyze Squirrel nupkg for long paths if: matrix.platform == 'windows' @@ -362,7 +382,7 @@ jobs: env: BUILD_CHANNEL: ${{ env.BUILD_CHANNEL }} USE_SYSTEM_FPM: true - run: pnpm exec electron-builder --config electron-builder.yaml --linux --${{ matrix.electron_arch }} + run: pnpm exec electron-builder --config electron-builder.config.cjs --linux --${{ matrix.electron_arch }} - name: Prepare artifacts (Windows) if: runner.os == 'Windows' diff --git a/fluxer_app/electron-builder.canary.yaml b/fluxer_app/electron-builder.canary.yaml deleted file mode 100644 index f90cb333..00000000 --- a/fluxer_app/electron-builder.canary.yaml +++ /dev/null @@ -1,114 +0,0 @@ -appId: app.fluxer.canary -productName: Fluxer Canary -copyright: Copyright (C) 2026 Fluxer Contributors - -artifactName: fluxer-${version}-${arch}.${ext} - -directories: - output: dist-electron - buildResources: electron-build-resources - -files: - - src-electron/dist/**/* - - "!**/*.map" - - "!**/*.md" - - "!**/README*" - - "!**/readme*" - - "!**/CHANGELOG*" - - "!**/LICENSE*" - - "!**/.github/**" - - "!**/docs/**" - - "!**/doc/**" - - "!**/example/**" - - "!**/examples/**" - - "!**/test/**" - - "!**/tests/**" - - "!**/__tests__/**" - - "!**/*.ts" - - "!**/tsconfig*.json" - -extraMetadata: - main: src-electron/dist/main/index.js - type: module - -asar: true -compression: normal - -asarUnpack: - - "**/*.node" - - "**/node_modules/uiohook-napi/**" - - "**/node_modules/input-monitoring-check/**" - - "**/src-electron/dist/preload/**" - -extraResources: - - from: electron-build-resources/icons-canary/512x512.png - to: 512x512.png - - from: electron-build-resources/icons-canary/badges - to: badges - - from: electron-build-resources/icons-canary/_compiled/Assets.car - to: Assets.car - -mac: - category: public.app-category.social-networking - icon: electron-build-resources/icons-canary/_compiled/AppIcon.icns - hardenedRuntime: true - gatekeeperAssess: false - entitlements: electron-build-resources/entitlements.mac.canary.plist - entitlementsInherit: electron-build-resources/entitlements.mac.inherit.plist - provisioningProfile: electron-build-resources/profiles/Fluxer_Canary.provisionprofile - extendInfo: - CFBundleIconName: AppIcon - NSMicrophoneUsageDescription: Fluxer needs access to your microphone for voice chat. - NSCameraUsageDescription: Fluxer needs access to your camera for video chat. - NSInputMonitoringUsageDescription: Fluxer needs Input Monitoring access for global shortcuts and hotkeys. - notarize: true - target: - - target: dmg - arch: - - x64 - - arm64 - - target: zip - arch: - - x64 - - arm64 - -dmg: - sign: false - icon: electron-build-resources/icons-canary/_compiled/AppIcon.icns - format: UDZO - contents: - - x: 130 - y: 220 - - x: 410 - y: 220 - type: link - path: /Applications - -win: - icon: electron-build-resources/icons-canary/icon.ico - target: - - squirrel - -squirrelWindows: - iconUrl: https://fluxerstatic.com/web/icons/desktop/canary/icon.ico - -linux: - icon: electron-build-resources/icons-canary - category: Network - maintainer: Fluxer Contributors - synopsis: Fluxer Canary - description: Fluxer Canary - executableName: fluxercanary - target: - - dir - - AppImage - - deb - - rpm - - tar.gz - mimeTypes: - - x-scheme-handler/fluxer - -protocols: - - name: Fluxer - schemes: - - fluxer diff --git a/fluxer_app/electron-builder.config.cjs b/fluxer_app/electron-builder.config.cjs new file mode 100644 index 00000000..49e6edad --- /dev/null +++ b/fluxer_app/electron-builder.config.cjs @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2026 Fluxer Contributors + * + * This file is part of Fluxer. + * + * Fluxer is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Fluxer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Fluxer. If not, see . + */ + +/** @type {import('electron-builder').Configuration} */ +const config = (() => { + const channel = process.env.BUILD_CHANNEL === 'canary' ? 'canary' : 'stable'; + const isCanary = channel === 'canary'; + + const appId = isCanary ? 'app.fluxer.canary' : 'app.fluxer'; + const productName = isCanary ? 'Fluxer Canary' : 'Fluxer'; + const iconsDir = isCanary ? 'electron-build-resources/icons-canary' : 'electron-build-resources/icons-stable'; + + const macEntitlements = isCanary + ? 'electron-build-resources/entitlements.mac.canary.plist' + : 'electron-build-resources/entitlements.mac.stable.plist'; + + const macProfile = isCanary + ? 'electron-build-resources/profiles/Fluxer_Canary.provisionprofile' + : 'electron-build-resources/profiles/Fluxer.provisionprofile'; + + const winIconUrl = isCanary + ? 'https://fluxerstatic.com/web/icons/desktop/canary/icon.ico' + : 'https://fluxerstatic.com/web/icons/desktop/stable/icon.ico'; + + const linuxExecutableName = isCanary ? 'fluxercanary' : 'fluxer'; + const linuxSynopsis = productName; + const linuxDescription = productName; + + return { + appId, + productName, + copyright: 'Copyright (C) 2026 Fluxer Contributors', + + artifactName: `fluxer-${channel}-\${version}-\${arch}.\${ext}`, + + directories: { + output: 'dist-electron', + buildResources: 'electron-build-resources', + }, + + files: [ + 'src-electron/dist/**/*', + '!**/*.map', + '!**/*.md', + '!**/README*', + '!**/readme*', + '!**/CHANGELOG*', + '!**/LICENSE*', + '!**/.github/**', + '!**/docs/**', + '!**/doc/**', + '!**/example/**', + '!**/examples/**', + '!**/test/**', + '!**/tests/**', + '!**/__tests__/**', + '!**/*.ts', + '!**/tsconfig*.json', + ], + + extraMetadata: { + main: 'src-electron/dist/main/index.js', + type: 'module', + }, + + asar: true, + compression: 'normal', + + asarUnpack: [ + '**/*.node', + '**/node_modules/uiohook-napi/**', + '**/node_modules/input-monitoring-check/**', + '**/src-electron/dist/preload/**', + ], + + extraResources: [ + {from: `${iconsDir}/512x512.png`, to: '512x512.png'}, + {from: `${iconsDir}/badges`, to: 'badges'}, + {from: `${iconsDir}/_compiled/Assets.car`, to: 'Assets.car'}, + ], + + mac: { + category: 'public.app-category.social-networking', + icon: `${iconsDir}/_compiled/AppIcon.icns`, + hardenedRuntime: true, + gatekeeperAssess: false, + entitlements: macEntitlements, + entitlementsInherit: 'electron-build-resources/entitlements.mac.inherit.plist', + provisioningProfile: macProfile, + extendInfo: { + CFBundleIconName: 'AppIcon', + NSMicrophoneUsageDescription: 'Fluxer needs access to your microphone for voice chat.', + NSCameraUsageDescription: 'Fluxer needs access to your camera for video chat.', + NSInputMonitoringUsageDescription: 'Fluxer needs Input Monitoring access for global shortcuts and hotkeys.', + }, + notarize: true, + target: [ + {target: 'dmg', arch: ['x64', 'arm64']}, + {target: 'zip', arch: ['x64', 'arm64']}, + ], + }, + + dmg: { + sign: false, + icon: `${iconsDir}/_compiled/AppIcon.icns`, + format: 'UDZO', + contents: [ + {x: 130, y: 220}, + {x: 410, y: 220, type: 'link', path: '/Applications'}, + ], + }, + + win: { + icon: `${iconsDir}/icon.ico`, + target: [{target: 'squirrel'}], + }, + + squirrelWindows: { + iconUrl: winIconUrl, + }, + + linux: { + icon: iconsDir, + category: 'Network', + maintainer: 'Fluxer Contributors', + synopsis: linuxSynopsis, + description: linuxDescription, + executableName: linuxExecutableName, + target: ['dir', 'AppImage', 'deb', 'rpm', 'tar.gz'], + mimeTypes: ['x-scheme-handler/fluxer'], + }, + + protocols: [{name: 'Fluxer', schemes: ['fluxer']}], + }; +})(); + +module.exports = config; diff --git a/fluxer_app/electron-builder.yaml b/fluxer_app/electron-builder.yaml deleted file mode 100644 index 44bbb4b9..00000000 --- a/fluxer_app/electron-builder.yaml +++ /dev/null @@ -1,114 +0,0 @@ -appId: app.fluxer -productName: Fluxer -copyright: Copyright (C) 2026 Fluxer Contributors - -artifactName: fluxer-${version}-${arch}.${ext} - -directories: - output: dist-electron - buildResources: electron-build-resources - -files: - - src-electron/dist/**/* - - "!**/*.map" - - "!**/*.md" - - "!**/README*" - - "!**/readme*" - - "!**/CHANGELOG*" - - "!**/LICENSE*" - - "!**/.github/**" - - "!**/docs/**" - - "!**/doc/**" - - "!**/example/**" - - "!**/examples/**" - - "!**/test/**" - - "!**/tests/**" - - "!**/__tests__/**" - - "!**/*.ts" - - "!**/tsconfig*.json" - -extraMetadata: - main: src-electron/dist/main/index.js - type: module - -asar: true -compression: normal - -asarUnpack: - - "**/*.node" - - "**/node_modules/uiohook-napi/**" - - "**/node_modules/input-monitoring-check/**" - - "**/src-electron/dist/preload/**" - -extraResources: - - from: electron-build-resources/icons-stable/512x512.png - to: 512x512.png - - from: electron-build-resources/icons-stable/badges - to: badges - - from: electron-build-resources/icons-stable/_compiled/Assets.car - to: Assets.car - -mac: - category: public.app-category.social-networking - icon: electron-build-resources/icons-stable/_compiled/AppIcon.icns - hardenedRuntime: true - gatekeeperAssess: false - entitlements: electron-build-resources/entitlements.mac.stable.plist - entitlementsInherit: electron-build-resources/entitlements.mac.inherit.plist - provisioningProfile: electron-build-resources/profiles/Fluxer.provisionprofile - extendInfo: - CFBundleIconName: AppIcon - NSMicrophoneUsageDescription: Fluxer needs access to your microphone for voice chat. - NSCameraUsageDescription: Fluxer needs access to your camera for video chat. - NSInputMonitoringUsageDescription: Fluxer needs Input Monitoring access for global shortcuts and hotkeys. - notarize: true - target: - - target: dmg - arch: - - x64 - - arm64 - - target: zip - arch: - - x64 - - arm64 - -dmg: - sign: false - icon: electron-build-resources/icons-stable/_compiled/AppIcon.icns - format: UDZO - contents: - - x: 130 - y: 220 - - x: 410 - y: 220 - type: link - path: /Applications - -win: - icon: electron-build-resources/icons-stable/icon.ico - target: - - squirrel - -squirrelWindows: - iconUrl: https://fluxerstatic.com/web/icons/desktop/stable/icon.ico - -linux: - icon: electron-build-resources/icons-stable - category: Network - maintainer: Fluxer Contributors - synopsis: Fluxer - description: Fluxer - executableName: fluxer - target: - - dir - - AppImage - - deb - - rpm - - tar.gz - mimeTypes: - - x-scheme-handler/fluxer - -protocols: - - name: Fluxer - schemes: - - fluxer