mirror of
https://github.com/AmintaCCCP/GithubStarsManager.git
synced 2025-11-25 02:34:54 +08:00
42
.github/workflows/build-desktop.yml
vendored
42
.github/workflows/build-desktop.yml
vendored
@@ -399,9 +399,6 @@ jobs:
|
|||||||
shortcutName: 'GitHub Stars Manager'
|
shortcutName: 'GitHub Stars Manager'
|
||||||
};
|
};
|
||||||
} else if ('${{ matrix.os }}' === 'macos-latest') {
|
} else if ('${{ matrix.os }}' === 'macos-latest') {
|
||||||
// Check if signing certificates are available
|
|
||||||
const hasSigningCerts = '${{ secrets.CSC_LINK }}' && '${{ secrets.CSC_KEY_PASSWORD }}';
|
|
||||||
|
|
||||||
packageJson.build.mac = {
|
packageJson.build.mac = {
|
||||||
target: [
|
target: [
|
||||||
{
|
{
|
||||||
@@ -411,19 +408,13 @@ jobs:
|
|||||||
],
|
],
|
||||||
icon: 'build/icon.png',
|
icon: 'build/icon.png',
|
||||||
category: 'public.app-category.productivity',
|
category: 'public.app-category.productivity',
|
||||||
hardenedRuntime: hasSigningCerts,
|
hardenedRuntime: true,
|
||||||
gatekeeperAssess: false,
|
gatekeeperAssess: false
|
||||||
identity: hasSigningCerts ? undefined : null // Skip code signing if no certs
|
|
||||||
};
|
};
|
||||||
packageJson.build.dmg = {
|
packageJson.build.dmg = {
|
||||||
title: 'GitHub Stars Manager',
|
title: 'GitHub Stars Manager',
|
||||||
icon: 'build/icon.png'
|
icon: 'build/icon.png'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add afterSign hook to skip notarization if no credentials
|
|
||||||
if (!hasSigningCerts) {
|
|
||||||
console.log('No signing certificates found, building unsigned app');
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
packageJson.build.linux = {
|
packageJson.build.linux = {
|
||||||
target: 'AppImage',
|
target: 'AppImage',
|
||||||
@@ -452,25 +443,6 @@ jobs:
|
|||||||
echo "Build directory contents:"
|
echo "Build directory contents:"
|
||||||
ls -la build/ || echo "No build directory"
|
ls -la build/ || echo "No build directory"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Ensure build directory and icon exist
|
|
||||||
if [ ! -d "build" ]; then
|
|
||||||
mkdir -p build
|
|
||||||
echo "Created build directory"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "build/icon.png" ]; then
|
|
||||||
if [ -f "assets/icon.png" ]; then
|
|
||||||
cp assets/icon.png build/icon.png
|
|
||||||
echo "Copied icon from assets/"
|
|
||||||
elif [ -f "public/icon.png" ]; then
|
|
||||||
cp public/icon.png build/icon.png
|
|
||||||
echo "Copied icon from public/"
|
|
||||||
else
|
|
||||||
echo "Warning: No icon file found, electron-builder may fail"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Package.json build config:"
|
echo "Package.json build config:"
|
||||||
node -e "console.log(JSON.stringify(require('./package.json').build, null, 2))"
|
node -e "console.log(JSON.stringify(require('./package.json').build, null, 2))"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -487,21 +459,15 @@ jobs:
|
|||||||
chmod -R 755 electron/ || echo "Could not set electron permissions"
|
chmod -R 755 electron/ || echo "Could not set electron permissions"
|
||||||
chmod -R 755 build/ || echo "Could not set build permissions"
|
chmod -R 755 build/ || echo "Could not set build permissions"
|
||||||
|
|
||||||
- name: Make build script executable
|
|
||||||
shell: bash
|
|
||||||
run: chmod +x scripts/build-electron.js
|
|
||||||
|
|
||||||
- name: Build Electron app
|
- name: Build Electron app
|
||||||
run: node scripts/build-electron.js
|
run: npm run dist
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CI: true
|
CI: true
|
||||||
DEBUG: electron-builder
|
DEBUG: electron-builder
|
||||||
# Linux 特定环境变量
|
# Linux 特定环境变量
|
||||||
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES: true
|
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES: true
|
||||||
# Disable code signing for unsigned builds
|
# macOS signing and notarization
|
||||||
CSC_IDENTITY_AUTO_DISCOVERY: false
|
|
||||||
# Only set signing vars if they exist
|
|
||||||
CSC_LINK: ${{ secrets.CSC_LINK }}
|
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
|
|||||||
@@ -12,22 +12,18 @@ files:
|
|||||||
- electron/**/*
|
- electron/**/*
|
||||||
- node_modules/**/*
|
- node_modules/**/*
|
||||||
- package.json
|
- package.json
|
||||||
- "!node_modules/.cache/**/*"
|
|
||||||
- "!**/*.map"
|
|
||||||
|
|
||||||
extraMetadata:
|
extraMetadata:
|
||||||
main: electron/main.js
|
main: electron/main.js
|
||||||
|
|
||||||
compression: normal
|
|
||||||
asar: false
|
|
||||||
|
|
||||||
# Windows配置
|
# Windows配置
|
||||||
win:
|
win:
|
||||||
target:
|
target:
|
||||||
- target: nsis
|
- target: nsis
|
||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
icon: build/icon.png
|
- ia32
|
||||||
|
icon: dist/vite.svg
|
||||||
|
|
||||||
nsis:
|
nsis:
|
||||||
oneClick: false
|
oneClick: false
|
||||||
@@ -43,15 +39,26 @@ mac:
|
|||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
- arm64
|
- arm64
|
||||||
icon: build/icon.png
|
icon: dist/vite.svg
|
||||||
category: public.app-category.productivity
|
category: public.app-category.productivity
|
||||||
hardenedRuntime: false
|
hardenedRuntime: true
|
||||||
gatekeeperAssess: false
|
entitlements: build/entitlements.mac.plist
|
||||||
identity: null
|
entitlementsInherit: build/entitlements.mac.inherit.plist
|
||||||
|
|
||||||
dmg:
|
dmg:
|
||||||
title: GitHub Stars Manager
|
title: GitHub Stars Manager
|
||||||
icon: build/icon.png
|
icon: dist/vite.svg
|
||||||
|
window:
|
||||||
|
width: 540
|
||||||
|
height: 380
|
||||||
|
contents:
|
||||||
|
- x: 410
|
||||||
|
y: 230
|
||||||
|
type: link
|
||||||
|
path: /Applications
|
||||||
|
- x: 130
|
||||||
|
y: 230
|
||||||
|
type: file
|
||||||
|
|
||||||
# Linux配置
|
# Linux配置
|
||||||
linux:
|
linux:
|
||||||
@@ -59,8 +66,21 @@ linux:
|
|||||||
- target: AppImage
|
- target: AppImage
|
||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
icon: build/icon.png
|
- target: deb
|
||||||
|
arch:
|
||||||
|
- x64
|
||||||
|
- target: rpm
|
||||||
|
arch:
|
||||||
|
- x64
|
||||||
|
icon: dist/vite.svg
|
||||||
category: Office
|
category: Office
|
||||||
|
synopsis: AI-powered GitHub starred repositories management tool
|
||||||
|
description: >
|
||||||
|
GitHub Stars Manager is an intelligent tool for organizing and managing
|
||||||
|
your GitHub starred repositories with AI-powered analysis and release tracking.
|
||||||
|
|
||||||
# 发布配置 - 禁用自动发布
|
# 发布配置
|
||||||
publish: null
|
publish:
|
||||||
|
provider: github
|
||||||
|
owner: your-username
|
||||||
|
repo: your-repo-name
|
||||||
59
package.json
59
package.json
@@ -3,8 +3,6 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.5",
|
"version": "0.1.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "electron/main.js",
|
|
||||||
"homepage": "./",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
@@ -13,8 +11,7 @@
|
|||||||
"build:desktop": "node scripts/build-desktop.js",
|
"build:desktop": "node scripts/build-desktop.js",
|
||||||
"electron": "electron electron/main.js",
|
"electron": "electron electron/main.js",
|
||||||
"electron:dev": "NODE_ENV=development electron electron/main.js",
|
"electron:dev": "NODE_ENV=development electron electron/main.js",
|
||||||
"dist": "node scripts/build-electron.js",
|
"dist": "electron-builder",
|
||||||
"dist:direct": "electron-builder",
|
|
||||||
"update-version": "node scripts/update-version.cjs"
|
"update-version": "node scripts/update-version.cjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -31,67 +28,15 @@
|
|||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"@vitejs/plugin-react": "^4.3.1",
|
"@vitejs/plugin-react": "^4.3.1",
|
||||||
"autoprefixer": "^10.4.18",
|
"autoprefixer": "^10.4.18",
|
||||||
"electron": "^38.1.2",
|
|
||||||
"electron-builder": "^26.0.12",
|
|
||||||
"eslint": "^9.9.1",
|
"eslint": "^9.9.1",
|
||||||
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.11",
|
"eslint-plugin-react-refresh": "^0.4.11",
|
||||||
"globals": "^15.9.0",
|
"globals": "^15.9.0",
|
||||||
"postcss": "^8.4.35",
|
"postcss": "^8.4.35",
|
||||||
"sharp": "^0.34.4",
|
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^3.4.1",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"typescript-eslint": "^8.3.0",
|
"typescript-eslint": "^8.3.0",
|
||||||
"vite": "^5.4.2",
|
"vite": "^5.4.2",
|
||||||
"xml2js": "^0.6.2"
|
"xml2js": "^0.6.2"
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"appId": "com.github-stars-manager.app",
|
|
||||||
"productName": "GitHub Stars Manager",
|
|
||||||
"directories": {
|
|
||||||
"output": "release",
|
|
||||||
"buildResources": "build"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist/**/*",
|
|
||||||
"build/**/*",
|
|
||||||
"electron/**/*",
|
|
||||||
"node_modules/**/*",
|
|
||||||
"package.json",
|
|
||||||
"!node_modules/.cache/**/*",
|
|
||||||
"!**/*.map"
|
|
||||||
],
|
|
||||||
"extraResources": [
|
|
||||||
{
|
|
||||||
"from": "dist",
|
|
||||||
"to": "dist",
|
|
||||||
"filter": [
|
|
||||||
"**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"compression": "normal",
|
|
||||||
"asar": false,
|
|
||||||
"publish": null,
|
|
||||||
"mac": {
|
|
||||||
"target": [
|
|
||||||
{
|
|
||||||
"target": "dmg",
|
|
||||||
"arch": [
|
|
||||||
"x64",
|
|
||||||
"arm64"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"icon": "build/icon.png",
|
|
||||||
"category": "public.app-category.productivity",
|
|
||||||
"hardenedRuntime": false,
|
|
||||||
"gatekeeperAssess": false,
|
|
||||||
"identity": null
|
|
||||||
},
|
|
||||||
"dmg": {
|
|
||||||
"title": "GitHub Stars Manager",
|
|
||||||
"icon": "build/icon.png"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const { execSync } = require('child_process');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
console.log('🚀 Starting Electron build process...');
|
|
||||||
|
|
||||||
// Check if we're on macOS and handle signing
|
|
||||||
const isMacOS = process.platform === 'darwin';
|
|
||||||
const hasSigningCerts = process.env.CSC_LINK && process.env.CSC_KEY_PASSWORD;
|
|
||||||
|
|
||||||
if (isMacOS && !hasSigningCerts) {
|
|
||||||
console.log('⚠️ No signing certificates found for macOS build');
|
|
||||||
console.log('📦 Building unsigned macOS app...');
|
|
||||||
|
|
||||||
// Set environment variables to skip signing
|
|
||||||
process.env.CSC_IDENTITY_AUTO_DISCOVERY = 'false';
|
|
||||||
process.env.CSC_LINK = '';
|
|
||||||
process.env.CSC_KEY_PASSWORD = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure build directory exists
|
|
||||||
if (!fs.existsSync('build')) {
|
|
||||||
fs.mkdirSync('build', { recursive: true });
|
|
||||||
console.log('📁 Created build directory');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy icon if it exists
|
|
||||||
const iconSources = ['assets/icon.png', 'public/icon.png', 'src/assets/icon.png'];
|
|
||||||
let iconCopied = false;
|
|
||||||
|
|
||||||
for (const iconPath of iconSources) {
|
|
||||||
if (fs.existsSync(iconPath)) {
|
|
||||||
fs.copyFileSync(iconPath, 'build/icon.png');
|
|
||||||
console.log(`📷 Copied icon from ${iconPath}`);
|
|
||||||
iconCopied = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!iconCopied) {
|
|
||||||
console.log('⚠️ No icon found, using default');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Debug environment
|
|
||||||
console.log('🔍 Environment info:');
|
|
||||||
console.log(`Platform: ${process.platform}`);
|
|
||||||
console.log(`Architecture: ${process.arch}`);
|
|
||||||
console.log(`Node version: ${process.version}`);
|
|
||||||
console.log(`CSC_IDENTITY_AUTO_DISCOVERY: ${process.env.CSC_IDENTITY_AUTO_DISCOVERY}`);
|
|
||||||
|
|
||||||
// Check required files
|
|
||||||
const requiredFiles = ['dist/index.html', 'electron/main.js', 'build/icon.png'];
|
|
||||||
for (const file of requiredFiles) {
|
|
||||||
if (fs.existsSync(file)) {
|
|
||||||
console.log(`✅ Found: ${file}`);
|
|
||||||
} else {
|
|
||||||
console.log(`⚠️ Missing: ${file}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run electron-builder
|
|
||||||
console.log('🔨 Running electron-builder...');
|
|
||||||
execSync('npx electron-builder --publish=never', {
|
|
||||||
stdio: 'inherit',
|
|
||||||
env: { ...process.env }
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('✅ Electron build completed successfully!');
|
|
||||||
|
|
||||||
// List output files
|
|
||||||
if (fs.existsSync('release')) {
|
|
||||||
console.log('📦 Build artifacts:');
|
|
||||||
const files = fs.readdirSync('release');
|
|
||||||
files.forEach(file => console.log(` - ${file}`));
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('❌ Electron build failed:', error.message);
|
|
||||||
console.error('Stack trace:', error.stack);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user