feat: replace electron builder with electron forge (#112)
* feat: replace electron builder with electron forge * chore: actions versions * chore: use npm for actions * chore: remove apple cert * Revert "chore: remove apple cert" This reverts commit e20dc3f7353e47c51a08c4e00f9246881dcb5560. * Revert "chore: use npm for actions" This reverts commit 89e21923f6ea6cacd9c037b66825ab73999c0a84. * chore: pip install setuptools * chore: remove setup pnpm * chore: remove cache pnpm * Revert "chore: remove cache pnpm" This reverts commit 8f04ce04de42a3931706657a637179193cd50404. * chore: ci * chore: ci * chore: fix runner.os * chore: ci * chore: remove MakerZIP * chore: rpm
This commit is contained in:
parent
c344439db3
commit
8fe125d55e
|
|
@ -13,6 +13,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
|
||||
|
|
@ -29,35 +30,54 @@ jobs:
|
|||
${{ runner.os }}-
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3.0.0
|
||||
with:
|
||||
version: latest
|
||||
run_install: true
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4.0.2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
node-version: 22
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Build/release Electron app
|
||||
uses: songkeys/action-electron-builder@master
|
||||
with:
|
||||
# GitHub token, automatically provided to the action
|
||||
# (No need to define this secret in the repo settings)
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Install appdmg
|
||||
if: runner.os == 'macOS'
|
||||
run: pnpm add -g appdmg
|
||||
|
||||
skip_install: true
|
||||
- name: Install the Apple certificate and provisioning profile
|
||||
if: runner.os == 'macOS'
|
||||
env:
|
||||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
||||
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
|
||||
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
run: |
|
||||
# create variables
|
||||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
|
||||
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
|
||||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
|
||||
|
||||
# If the commit is tagged with a version (e.g. "v1.0.0"),
|
||||
# release the app after building
|
||||
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
# import certificate and provisioning profile from secrets
|
||||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
|
||||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
|
||||
|
||||
mac_certs: ${{ secrets.mac_certs }}
|
||||
mac_certs_password: ${{ secrets.mac_certs_password }}
|
||||
# create temporary keychain
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
|
||||
- name: List files
|
||||
run: ls -l dist
|
||||
# import certificate to keychain
|
||||
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
|
||||
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
security list-keychain -d user -s $KEYCHAIN_PATH
|
||||
|
||||
# apply provisioning profile
|
||||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm i
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
- name: Upload file
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
@ -66,7 +86,8 @@ jobs:
|
|||
with:
|
||||
name: ${{ runner.os }}
|
||||
path: |
|
||||
dist/*.dmg
|
||||
dist/*.exe
|
||||
dist/*.AppImage
|
||||
out/**/*.dmg
|
||||
out/**/*.exe
|
||||
out/**/*.deb
|
||||
out/**/*.rpm
|
||||
retention-days: 90
|
||||
|
|
|
|||
|
|
@ -6,5 +6,13 @@
|
|||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.print</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
appId: io.follow
|
||||
productName: Follow
|
||||
directories:
|
||||
buildResources: build
|
||||
files:
|
||||
# - "**/*"
|
||||
# - "!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}"
|
||||
# - "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}"
|
||||
# - "!**/node_modules/*.d.ts"
|
||||
# - "!**/node_modules/.bin"
|
||||
# - "!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}"
|
||||
# - "!.editorconfig"
|
||||
# - "!**/._*"
|
||||
# - "!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}"
|
||||
# - "!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}"
|
||||
# - "!**/{appveyor.yml,.travis.yml,circle.yml}"
|
||||
# - "!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
|
||||
# - "!**/.vscode/*"
|
||||
# - "!src/*"
|
||||
# - "!electron.vite.config.{js,ts,mjs,cjs}"
|
||||
# - "!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}"
|
||||
# - "!{.env,.env.*,.npmrc,pnpm-lock.yaml}"
|
||||
# - "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}"
|
||||
- "out"
|
||||
- "resources"
|
||||
- "!node_modules"
|
||||
- "node_modules/font-list/**/*"
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
win:
|
||||
executableName: follow
|
||||
icon: resources/icon.png
|
||||
nsis:
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
mac:
|
||||
entitlements: build/entitlements.mac.plist
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
extendInfo:
|
||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
icon: resources/icon.icns
|
||||
hardenedRuntime: true
|
||||
gatekeeperAssess: false
|
||||
dmg:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
- deb
|
||||
maintainer: electronjs.org
|
||||
category: Utility
|
||||
appImage:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: generic
|
||||
url: https://example.com/auto-updates
|
||||
protocols:
|
||||
name: Follow
|
||||
schemes:
|
||||
- follow
|
||||
- feed
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import { FuseV1Options, FuseVersion } from "@electron/fuses"
|
||||
import { MakerDeb } from "@electron-forge/maker-deb"
|
||||
import { MakerDMG } from "@electron-forge/maker-dmg"
|
||||
import { MakerRpm } from "@electron-forge/maker-rpm"
|
||||
import { MakerSquirrel } from "@electron-forge/maker-squirrel"
|
||||
import { FusesPlugin } from "@electron-forge/plugin-fuses"
|
||||
import type { ForgeConfig } from "@electron-forge/shared-types"
|
||||
|
||||
const config: ForgeConfig = {
|
||||
packagerConfig: {
|
||||
appBundleId: "is.follow",
|
||||
icon: "resources/icon",
|
||||
ignore: [
|
||||
/^\/src/,
|
||||
/(.eslintrc.json)|(.gitignore)|(electron.vite.config.ts)|(forge.config.ts)|(tsconfig.*)/,
|
||||
],
|
||||
asar: true,
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
new MakerSquirrel({}),
|
||||
new MakerRpm({}),
|
||||
new MakerDeb({
|
||||
options: {
|
||||
icon: "resources/icon.png",
|
||||
},
|
||||
}),
|
||||
new MakerDMG({}),
|
||||
],
|
||||
plugins: [
|
||||
// Fuses are used to enable/disable various Electron functionality
|
||||
// at package time, before code signing the application
|
||||
new FusesPlugin({
|
||||
version: FuseVersion.V1,
|
||||
[FuseV1Options.RunAsNode]: false,
|
||||
[FuseV1Options.EnableCookieEncryption]: true,
|
||||
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
|
||||
[FuseV1Options.EnableNodeCliInspectArguments]: false,
|
||||
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
|
||||
[FuseV1Options.OnlyLoadAppFromAsar]: true,
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
||||
export default config
|
||||
17
package.json
17
package.json
|
|
@ -5,19 +5,15 @@
|
|||
"packageManager": "pnpm@9.1.4",
|
||||
"description": "An Electron application with React and TypeScript",
|
||||
"author": "example.com",
|
||||
"license": "UNLICENSED",
|
||||
"homepage": "https://electron-vite.org",
|
||||
"main": "./out/main/index.js",
|
||||
"main": "./dist/main/index.js",
|
||||
"scripts": {
|
||||
"build": "npm run typecheck && electron-vite build",
|
||||
"build:linux": "electron-vite build && electron-builder --linux",
|
||||
"build:mac": "electron-vite build && electron-builder --mac",
|
||||
"build:unpack": "npm run build && electron-builder --dir",
|
||||
"build": "npm run typecheck && electron-vite build --outDir=dist && electron-forge package && electron-forge make",
|
||||
"build:web": "vite build",
|
||||
"build:win": "npm run build && electron-builder --win",
|
||||
"dev": "electron-vite dev",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"prepare": "pnpm exec simple-git-hooks && test -f .env || cp .env.example .env",
|
||||
"start": "electron-vite preview",
|
||||
"test": "vitest",
|
||||
|
|
@ -111,6 +107,12 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@egoist/tailwindcss-icons": "1.8.1",
|
||||
"@electron-forge/cli": "7.4.0",
|
||||
"@electron-forge/maker-deb": "7.4.0",
|
||||
"@electron-forge/maker-dmg": "7.4.0",
|
||||
"@electron-forge/maker-rpm": "7.4.0",
|
||||
"@electron-forge/maker-squirrel": "7.4.0",
|
||||
"@electron-forge/plugin-fuses": "7.4.0",
|
||||
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||
"@iconify-json/mingcute": "1.1.18",
|
||||
"@tailwindcss/container-queries": "0.1.1",
|
||||
|
|
@ -124,7 +126,6 @@
|
|||
"@vercel/ncc": "0.38.1",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"electron": "^30.1.2",
|
||||
"electron-builder": "24.9.1",
|
||||
"electron-devtools-installer": "3.2.0",
|
||||
"electron-vite": "^2.3.0",
|
||||
"eslint": "^9.6.0",
|
||||
|
|
|
|||
2359
pnpm-lock.yaml
2359
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue