mirror of
https://github.com/AmintaCCCP/GithubStarsManager.git
synced 2025-11-25 10:38:18 +08:00
fix workflow
This commit is contained in:
42
.github/workflows/build-desktop.yml
vendored
42
.github/workflows/build-desktop.yml
vendored
@@ -399,6 +399,9 @@ 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: [
|
||||||
{
|
{
|
||||||
@@ -408,13 +411,19 @@ jobs:
|
|||||||
],
|
],
|
||||||
icon: 'build/icon.png',
|
icon: 'build/icon.png',
|
||||||
category: 'public.app-category.productivity',
|
category: 'public.app-category.productivity',
|
||||||
hardenedRuntime: true,
|
hardenedRuntime: hasSigningCerts,
|
||||||
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',
|
||||||
@@ -443,6 +452,25 @@ 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 ""
|
||||||
@@ -459,15 +487,21 @@ 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: npm run dist
|
run: node scripts/build-electron.js
|
||||||
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
|
||||||
# macOS signing and notarization
|
# Disable code signing for unsigned builds
|
||||||
|
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,18 +12,22 @@ 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
|
||||||
- ia32
|
icon: build/icon.png
|
||||||
icon: dist/vite.svg
|
|
||||||
|
|
||||||
nsis:
|
nsis:
|
||||||
oneClick: false
|
oneClick: false
|
||||||
@@ -39,26 +43,15 @@ mac:
|
|||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
- arm64
|
- arm64
|
||||||
icon: dist/vite.svg
|
icon: build/icon.png
|
||||||
category: public.app-category.productivity
|
category: public.app-category.productivity
|
||||||
hardenedRuntime: true
|
hardenedRuntime: false
|
||||||
entitlements: build/entitlements.mac.plist
|
gatekeeperAssess: false
|
||||||
entitlementsInherit: build/entitlements.mac.inherit.plist
|
identity: null
|
||||||
|
|
||||||
dmg:
|
dmg:
|
||||||
title: GitHub Stars Manager
|
title: GitHub Stars Manager
|
||||||
icon: dist/vite.svg
|
icon: build/icon.png
|
||||||
window:
|
|
||||||
width: 540
|
|
||||||
height: 380
|
|
||||||
contents:
|
|
||||||
- x: 410
|
|
||||||
y: 230
|
|
||||||
type: link
|
|
||||||
path: /Applications
|
|
||||||
- x: 130
|
|
||||||
y: 230
|
|
||||||
type: file
|
|
||||||
|
|
||||||
# Linux配置
|
# Linux配置
|
||||||
linux:
|
linux:
|
||||||
@@ -66,21 +59,8 @@ linux:
|
|||||||
- target: AppImage
|
- target: AppImage
|
||||||
arch:
|
arch:
|
||||||
- x64
|
- x64
|
||||||
- target: deb
|
icon: build/icon.png
|
||||||
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:
|
publish: null
|
||||||
provider: github
|
|
||||||
owner: your-username
|
|
||||||
repo: your-repo-name
|
|
||||||
59
package.json
59
package.json
@@ -3,6 +3,8 @@
|
|||||||
"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",
|
||||||
@@ -11,7 +13,8 @@
|
|||||||
"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": "electron-builder",
|
"dist": "node scripts/build-electron.js",
|
||||||
|
"dist:direct": "electron-builder",
|
||||||
"update-version": "node scripts/update-version.cjs"
|
"update-version": "node scripts/update-version.cjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -28,15 +31,67 @@
|
|||||||
"@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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
83
scripts/build-electron.js
Normal file
83
scripts/build-electron.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
#!/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