mirror of
https://github.com/AmintaCCCP/GithubStarsManager.git
synced 2025-11-25 02:34:54 +08:00
update icon
This commit is contained in:
123
.github/workflows/build-desktop.yml
vendored
123
.github/workflows/build-desktop.yml
vendored
@@ -53,32 +53,129 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
node -e "
|
node -e "
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const sharp = require('sharp');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// Create basic icon files for build process
|
async function generateIcons() {
|
||||||
const buildDir = 'build';
|
const buildDir = 'build';
|
||||||
if (!fs.existsSync(buildDir)) {
|
if (!fs.existsSync(buildDir)) {
|
||||||
fs.mkdirSync(buildDir, { recursive: true });
|
fs.mkdirSync(buildDir, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a simple base64 encoded 1x1 PNG as placeholder
|
// Look for source icon in common locations
|
||||||
const pngBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';
|
let sourceIcon = null;
|
||||||
const pngBuffer = Buffer.from(pngBase64, 'base64');
|
const possiblePaths = [
|
||||||
|
'assets/icon.png',
|
||||||
|
'public/icon.png',
|
||||||
|
'src/assets/icon.png',
|
||||||
|
'icon.png'
|
||||||
|
];
|
||||||
|
|
||||||
// Create placeholder icon files with actual PNG data
|
for (const iconPath of possiblePaths) {
|
||||||
fs.writeFileSync('build/icon-512x512.png', pngBuffer);
|
if (fs.existsSync(iconPath)) {
|
||||||
|
sourceIcon = iconPath;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create minimal ICO file (Windows)
|
if (!sourceIcon) {
|
||||||
const icoHeader = Buffer.from([0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]);
|
console.log('No source icon found, creating default icon...');
|
||||||
const icoData = Buffer.concat([icoHeader, pngBuffer]);
|
// Create a simple colored square as default
|
||||||
fs.writeFileSync('build/icon.ico', icoData);
|
await sharp({
|
||||||
|
create: {
|
||||||
|
width: 512,
|
||||||
|
height: 512,
|
||||||
|
channels: 4,
|
||||||
|
background: { r: 59, g: 130, b: 246, alpha: 1 }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.png()
|
||||||
|
.toFile('build/icon-512x512.png');
|
||||||
|
|
||||||
// Create minimal ICNS file (macOS) - just copy the PNG for now
|
// Copy for other formats
|
||||||
fs.writeFileSync('build/icon.icns', pngBuffer);
|
fs.copyFileSync('build/icon-512x512.png', 'build/icon.png');
|
||||||
|
} else {
|
||||||
|
console.log('Using source icon:', sourceIcon);
|
||||||
|
|
||||||
console.log('Icon files created successfully');
|
// Generate PNG icons for Linux
|
||||||
|
await sharp(sourceIcon)
|
||||||
|
.resize(512, 512)
|
||||||
|
.png()
|
||||||
|
.toFile('build/icon-512x512.png');
|
||||||
|
|
||||||
|
await sharp(sourceIcon)
|
||||||
|
.resize(256, 256)
|
||||||
|
.png()
|
||||||
|
.toFile('build/icon-256x256.png');
|
||||||
|
|
||||||
|
// Copy original for general use
|
||||||
|
fs.copyFileSync(sourceIcon, 'build/icon.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Icon files generated successfully');
|
||||||
|
}
|
||||||
|
|
||||||
|
generateIcons().catch(console.error);
|
||||||
"
|
"
|
||||||
|
|
||||||
|
- name: Generate Windows ICO file
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Install imagemagick for ICO conversion
|
||||||
|
if command -v magick >/dev/null 2>&1; then
|
||||||
|
magick build/icon.png -define icon:auto-resize=256,128,64,48,32,16 build/icon.ico
|
||||||
|
elif command -v convert >/dev/null 2>&1; then
|
||||||
|
convert build/icon.png -define icon:auto-resize=256,128,64,48,32,16 build/icon.ico
|
||||||
|
else
|
||||||
|
echo "ImageMagick not available, using PNG as fallback"
|
||||||
|
cp build/icon-512x512.png build/icon.ico
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate macOS ICNS file
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Create iconset directory
|
||||||
|
mkdir -p build/icon.iconset
|
||||||
|
|
||||||
|
# Generate different sizes for ICNS
|
||||||
|
node -e "
|
||||||
|
const sharp = require('sharp');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
async function generateIconSet() {
|
||||||
|
const sizes = [16, 32, 64, 128, 256, 512, 1024];
|
||||||
|
const sourceIcon = fs.existsSync('build/icon.png') ? 'build/icon.png' : 'build/icon-512x512.png';
|
||||||
|
|
||||||
|
for (const size of sizes) {
|
||||||
|
await sharp(sourceIcon)
|
||||||
|
.resize(size, size)
|
||||||
|
.png()
|
||||||
|
.toFile(\`build/icon.iconset/icon_\${size}x\${size}.png\`);
|
||||||
|
|
||||||
|
if (size <= 512) {
|
||||||
|
await sharp(sourceIcon)
|
||||||
|
.resize(size * 2, size * 2)
|
||||||
|
.png()
|
||||||
|
.toFile(\`build/icon.iconset/icon_\${size}x\${size}@2x.png\`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('IconSet generated');
|
||||||
|
}
|
||||||
|
|
||||||
|
generateIconSet().catch(console.error);
|
||||||
|
"
|
||||||
|
|
||||||
|
# Convert to ICNS using iconutil (macOS only)
|
||||||
|
if command -v iconutil >/dev/null 2>&1; then
|
||||||
|
iconutil -c icns build/icon.iconset -o build/icon.icns
|
||||||
|
else
|
||||||
|
echo "iconutil not available, using PNG as fallback"
|
||||||
|
cp build/icon-512x512.png build/icon.icns
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Install Electron dependencies
|
- name: Install Electron dependencies
|
||||||
run: npm install --save-dev electron electron-builder
|
run: npm install --save-dev electron electron-builder
|
||||||
|
|
||||||
|
|||||||
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user