feat(build): refactor Electron build configuration and CI workflow
- Removed the electron-builder.yml file and integrated its configuration directly into package.json, streamlining the build process. - Updated build scripts in package.json to simplify the distribution commands for macOS and Windows. - Enhanced the GitHub Actions workflow to separate build and release jobs, improving CI efficiency and clarity. - Added artifact upload and download steps to facilitate the release process for both macOS and Windows. This commit optimizes the build configuration and CI workflow, making it more maintainable and efficient for future releases.
This commit is contained in:
parent
cffa3eb431
commit
720951ec2e
4 changed files with 102 additions and 63 deletions
60
.github/workflows/release.yml
vendored
60
.github/workflows/release.yml
vendored
|
|
@ -10,8 +10,8 @@ permissions:
|
|||
contents: write
|
||||
|
||||
jobs:
|
||||
package-mac:
|
||||
runs-on: macos-latest
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -32,13 +32,41 @@ jobs:
|
|||
- name: Build app
|
||||
run: pnpm build
|
||||
|
||||
- name: Package macOS
|
||||
uses: nick-fields/retry@v3
|
||||
- name: Upload dist artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
timeout_minutes: 30
|
||||
max_attempts: 3
|
||||
retry_wait_seconds: 10
|
||||
command: pnpm dist:mac --publish always
|
||||
name: dist
|
||||
path: |
|
||||
out/renderer
|
||||
dist-electron
|
||||
retention-days: 1
|
||||
|
||||
release-mac:
|
||||
needs: build
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download dist artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Package & Release (macOS)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||
|
|
@ -46,14 +74,21 @@ jobs:
|
|||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
run: pnpm dist:mac
|
||||
|
||||
package-win:
|
||||
release-win:
|
||||
needs: build
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download dist artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
|
|
@ -66,10 +101,7 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Build app
|
||||
run: pnpm build
|
||||
|
||||
- name: Package Windows
|
||||
- name: Package & Release (Windows)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm dist:win --publish always
|
||||
run: pnpm dist:win
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
appId: com.claudecode.context
|
||||
productName: claude-devtools
|
||||
|
||||
directories:
|
||||
output: release
|
||||
|
||||
files:
|
||||
- out/renderer/**
|
||||
- dist-electron/**
|
||||
- package.json
|
||||
|
||||
asar: true
|
||||
|
||||
extraMetadata:
|
||||
main: dist-electron/main/index.js
|
||||
|
||||
mac:
|
||||
category: public.app-category.developer-tools
|
||||
target:
|
||||
- dmg
|
||||
- zip
|
||||
hardenedRuntime: true
|
||||
gatekeeperAssess: false
|
||||
entitlements: resources/entitlements.mac.plist
|
||||
entitlementsInherit: resources/entitlements.mac.inherit.plist
|
||||
notarize:
|
||||
teamId: ${env.APPLE_TEAM_ID}
|
||||
icon: resources/icons/mac/icon.icns
|
||||
|
||||
dmg:
|
||||
sign: false
|
||||
|
||||
win:
|
||||
target:
|
||||
- nsis
|
||||
icon: resources/icons/win/icon.ico
|
||||
|
||||
nsis:
|
||||
oneClick: false
|
||||
perMachine: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
|
||||
publish:
|
||||
- provider: github
|
||||
releaseType: draft
|
||||
|
|
@ -10,7 +10,10 @@ export default defineConfig({
|
|||
'unified',
|
||||
'remark-parse',
|
||||
'remark-gfm',
|
||||
'mdast-util-to-hast'
|
||||
'mdast-util-to-hast',
|
||||
'fastify',
|
||||
'@fastify/cors',
|
||||
'@fastify/static'
|
||||
]
|
||||
})
|
||||
],
|
||||
|
|
|
|||
55
package.json
55
package.json
|
|
@ -17,9 +17,9 @@
|
|||
"scripts": {
|
||||
"dev": "electron-vite dev",
|
||||
"build": "electron-vite build",
|
||||
"dist": "electron-builder --config electron-builder.yml --mac --win",
|
||||
"dist:mac": "electron-builder --config electron-builder.yml --mac",
|
||||
"dist:win": "electron-builder --config electron-builder.yml --win",
|
||||
"dist": "electron-builder --mac --win",
|
||||
"dist:mac": "electron-builder --mac --publish always",
|
||||
"dist:win": "electron-builder --win --publish always",
|
||||
"preview": "electron-vite preview",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint src/",
|
||||
|
|
@ -112,6 +112,55 @@
|
|||
"vite": "^5.4.2",
|
||||
"vitest": "^3.1.4"
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.claudecode.context",
|
||||
"productName": "claude-devtools",
|
||||
"directories": {
|
||||
"output": "release"
|
||||
},
|
||||
"files": [
|
||||
"out/renderer/**",
|
||||
"dist-electron/**",
|
||||
"package.json"
|
||||
],
|
||||
"asar": true,
|
||||
"extraMetadata": {
|
||||
"main": "dist-electron/main/index.js"
|
||||
},
|
||||
"mac": {
|
||||
"category": "public.app-category.developer-tools",
|
||||
"target": [
|
||||
"dmg",
|
||||
"zip"
|
||||
],
|
||||
"hardenedRuntime": true,
|
||||
"gatekeeperAssess": false,
|
||||
"notarize": true,
|
||||
"entitlements": "resources/entitlements.mac.plist",
|
||||
"entitlementsInherit": "resources/entitlements.mac.inherit.plist",
|
||||
"icon": "resources/icons/mac/icon.icns"
|
||||
},
|
||||
"dmg": {
|
||||
"sign": false
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis"
|
||||
],
|
||||
"icon": "resources/icons/win/icon.ico"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"perMachine": false,
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"publish": [
|
||||
{
|
||||
"provider": "github",
|
||||
"releaseType": "draft"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"@electron/notarize": "^2.5.0"
|
||||
|
|
|
|||
Loading…
Reference in a new issue