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:
matt 2026-02-13 00:04:25 +09:00
parent cffa3eb431
commit 720951ec2e
4 changed files with 102 additions and 63 deletions

View file

@ -10,8 +10,8 @@ permissions:
contents: write contents: write
jobs: jobs:
package-mac: build:
runs-on: macos-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -32,13 +32,41 @@ jobs:
- name: Build app - name: Build app
run: pnpm build run: pnpm build
- name: Package macOS - name: Upload dist artifact
uses: nick-fields/retry@v3 uses: actions/upload-artifact@v4
with: with:
timeout_minutes: 30 name: dist
max_attempts: 3 path: |
retry_wait_seconds: 10 out/renderer
command: pnpm dist:mac --publish always 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: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.CSC_LINK }} CSC_LINK: ${{ secrets.CSC_LINK }}
@ -46,14 +74,21 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: pnpm dist:mac
package-win: release-win:
needs: build
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: dist
- name: Setup pnpm - name: Setup pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@ -66,10 +101,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install --no-frozen-lockfile run: pnpm install --no-frozen-lockfile
- name: Build app - name: Package & Release (Windows)
run: pnpm build
- name: Package Windows
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm dist:win --publish always run: pnpm dist:win

View file

@ -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

View file

@ -10,7 +10,10 @@ export default defineConfig({
'unified', 'unified',
'remark-parse', 'remark-parse',
'remark-gfm', 'remark-gfm',
'mdast-util-to-hast' 'mdast-util-to-hast',
'fastify',
'@fastify/cors',
'@fastify/static'
] ]
}) })
], ],

View file

@ -17,9 +17,9 @@
"scripts": { "scripts": {
"dev": "electron-vite dev", "dev": "electron-vite dev",
"build": "electron-vite build", "build": "electron-vite build",
"dist": "electron-builder --config electron-builder.yml --mac --win", "dist": "electron-builder --mac --win",
"dist:mac": "electron-builder --config electron-builder.yml --mac", "dist:mac": "electron-builder --mac --publish always",
"dist:win": "electron-builder --config electron-builder.yml --win", "dist:win": "electron-builder --win --publish always",
"preview": "electron-vite preview", "preview": "electron-vite preview",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "eslint src/", "lint": "eslint src/",
@ -112,6 +112,55 @@
"vite": "^5.4.2", "vite": "^5.4.2",
"vitest": "^3.1.4" "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": { "pnpm": {
"overrides": { "overrides": {
"@electron/notarize": "^2.5.0" "@electron/notarize": "^2.5.0"