Skip to content

Commit e413c7b

Browse files
committed
init:初始化项目
0 parents  commit e413c7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+12350
-0
lines changed

.github/workflows/release.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Build and Release
2+
3+
permissions:
4+
contents: write
5+
packages: write
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*.*.*"
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
os: [windows-latest, macos-latest, ubuntu-latest]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "18"
28+
cache: "npm"
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build application
34+
run: npm run build
35+
36+
- name: Build Electron app (Windows)
37+
if: matrix.os == 'windows-latest'
38+
run: npm run electron:build
39+
env:
40+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Build Electron app (macOS)
43+
if: matrix.os == 'macos-latest'
44+
run: npm run electron:build
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
CSC_IDENTITY_AUTO_DISCOVERY: false
48+
49+
- name: Build Electron app (Linux)
50+
if: matrix.os == 'ubuntu-latest'
51+
run: npm run electron:build
52+
env:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Upload Windows artifacts
56+
if: matrix.os == 'windows-latest'
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: windows-build
60+
path: |
61+
dist_electron/*.exe
62+
dist_electron/*.msi
63+
dist_electron/latest.yml
64+
65+
- name: Upload macOS artifacts
66+
if: matrix.os == 'macos-latest'
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: macos-build
70+
path: |
71+
dist_electron/*.dmg
72+
dist_electron/*.zip
73+
dist_electron/latest-mac.yml
74+
75+
- name: Upload Linux artifacts
76+
if: matrix.os == 'ubuntu-latest'
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: linux-build
80+
path: |
81+
dist_electron/*.AppImage
82+
dist_electron/latest-linux.yml
83+
84+
release:
85+
needs: build
86+
runs-on: ubuntu-latest
87+
permissions:
88+
contents: write
89+
90+
steps:
91+
- name: Checkout code
92+
uses: actions/checkout@v4
93+
94+
- name: Download all artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: artifacts
98+
99+
- name: Extract changelog
100+
id: changelog
101+
run: |
102+
# 提取当前版本的 changelog
103+
VERSION=${GITHUB_REF#refs/tags/v}
104+
echo "Extracting changelog for version: $VERSION"
105+
106+
# 调试:显示文件内容和版本信息
107+
echo "=== CHANGELOG.md content ==="
108+
cat CHANGELOG.md
109+
echo "=== End of CHANGELOG.md ==="
110+
echo "Looking for version: [$VERSION]"
111+
112+
# 使用更精确的awk脚本提取changelog内容
113+
CHANGELOG=$(awk -v version="$VERSION" '
114+
BEGIN { found=0; content="" }
115+
/^## \[/ {
116+
if (found && $0 !~ "\\[" version "\\]") {
117+
exit
118+
}
119+
if ($0 ~ "\\[" version "\\]") {
120+
found=1
121+
next
122+
}
123+
}
124+
found && !/^## \[/ {
125+
if (content != "") content = content "\n"
126+
content = content $0
127+
}
128+
END { print content }
129+
' CHANGELOG.md)
130+
131+
# 清理空行和空白字符
132+
CHANGELOG=$(echo "$CHANGELOG" | sed '/^[[:space:]]*$/d' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')
133+
134+
# 如果没有找到内容,输出调试信息
135+
if [ -z "$CHANGELOG" ]; then
136+
echo "No changelog found for version $VERSION"
137+
echo "Available versions in CHANGELOG.md:"
138+
grep "^## \[" CHANGELOG.md || echo "No version headers found"
139+
CHANGELOG="暂无更新日志"
140+
else
141+
echo "Found changelog content:"
142+
echo "$CHANGELOG"
143+
fi
144+
145+
# 使用多行输出格式
146+
{
147+
echo "CHANGELOG<<EOF"
148+
echo "$CHANGELOG"
149+
echo "EOF"
150+
} >> $GITHUB_OUTPUT
151+
152+
- name: Create Release
153+
uses: softprops/action-gh-release@v1
154+
with:
155+
name: Mbo Theme Tool ${{ github.ref_name }}
156+
body: |
157+
## 🚀 新版本发布 ${{ github.ref_name }}
158+
159+
${{ steps.changelog.outputs.CHANGELOG }}
160+
161+
### 📦 下载链接
162+
- **Windows**: 下载 `.exe` 文件
163+
- **macOS**: 下载 `.dmg` 文件
164+
- **Linux**: 下载 `.AppImage` 文件
165+
166+
### 🔧 安装说明
167+
1. 下载对应平台的安装包
168+
2. 运行安装程序
169+
3. 按照提示完成安装
170+
files: |
171+
artifacts/windows-build/*
172+
artifacts/macos-build/*
173+
artifacts/linux-build/*
174+
draft: false
175+
prerelease: false
176+
env:
177+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
*.lcov
22+
23+
# nyc test coverage
24+
.nyc_output
25+
26+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
27+
.grunt
28+
29+
# Bower dependency directory (https://bower.io/)
30+
bower_components
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (https://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directories
39+
node_modules/
40+
jspm_packages/
41+
42+
# Snowpack dependency directory (https://snowpack.dev/)
43+
web_modules/
44+
45+
# TypeScript cache
46+
*.tsbuildinfo
47+
48+
# Optional npm cache directory
49+
.npm
50+
51+
# Optional eslint cache
52+
.eslintcache
53+
54+
# Optional stylelint cache
55+
.stylelintcache
56+
57+
# Microbundle cache
58+
.rpt2_cache/
59+
.rts2_cache_cjs/
60+
.rts2_cache_es/
61+
.rts2_cache_umd/
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variable files
73+
.env
74+
.env.development.local
75+
.env.test.local
76+
.env.production.local
77+
.env.local
78+
79+
# parcel-bundler cache (https://parceljs.org/)
80+
.cache
81+
.parcel-cache
82+
83+
# Next.js build output
84+
.next
85+
out
86+
87+
# Nuxt.js build / generate output
88+
.nuxt
89+
dist
90+
91+
# Gatsby files
92+
.cache/
93+
# Comment in the public line in if your project uses Gatsby and not Next.js
94+
# https://nextjs.org/blog/next-9-1#public-directory-support
95+
# public
96+
97+
# vuepress build output
98+
.vuepress/dist
99+
100+
# vuepress v2.x temp and cache directory
101+
.temp
102+
.cache
103+
104+
# Docusaurus cache and generated files
105+
.docusaurus
106+
107+
# Serverless directories
108+
.serverless/
109+
110+
# FuseBox cache
111+
.fusebox/
112+
113+
# DynamoDB Local files
114+
.dynamodb/
115+
116+
# TernJS port file
117+
.tern-port
118+
119+
# Stores VSCode versions used for testing VSCode extensions
120+
.vscode-test
121+
122+
# yarn v2
123+
.yarn/cache
124+
.yarn/unplugged
125+
.yarn/build-state.yml
126+
.yarn/install-state.gz
127+
.pnp.*
128+
129+
# Electron build output
130+
dist_electron/
131+
132+
# Vite build output
133+
dist/
134+
135+
# Vite cache
136+
node_modules/.vite/
137+
138+
# IDE files
139+
.vscode/
140+
.idea/
141+
*.swp
142+
*.swo
143+
*~
144+
145+
# OS generated files
146+
.DS_Store
147+
.DS_Store?
148+
._*
149+
.Spotlight-V100
150+
.Trashes
151+
ehthumbs.db
152+
Thumbs.db
153+
154+
# Electron specific
155+
*.asar
156+
157+
# Build artifacts
158+
*.exe
159+
*.dmg
160+
*.AppImage
161+
*.deb
162+
*.rpm
163+
*.snap
164+
*.msi
165+
*.pkg
166+
167+
# Auto-generated files
168+
latest*.yml
169+
builder-debug.yml
170+
builder-effective-config.yaml
171+
172+
# Backup files
173+
electron/config/backup/
174+
175+
# Temporary files
176+
*.tmp
177+
*.temp
178+
179+
# test
180+
test-script

0 commit comments

Comments
 (0)