Skip to content

Commit 8704a28

Browse files
committed
chore: 重构工作流配置和路由,移除 HelloWorld 组件并优化页面样式
1 parent fb4d8f1 commit 8704a28

File tree

10 files changed

+757
-315
lines changed

10 files changed

+757
-315
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,13 @@ on:
55
branches: [main]
66
paths-ignore:
77
- "**.md"
8-
- "**.spec.js"
9-
- ".idea"
10-
- ".vscode"
11-
- ".dockerignore"
12-
- "Dockerfile"
13-
- ".gitignore"
148
- ".github/**"
159
- "!.github/workflows/build.yml"
10+
workflow_dispatch: # 允许手动触发
1611

1712
jobs:
1813
build:
19-
runs-on: ${{ matrix.os }}
20-
21-
strategy:
22-
matrix:
23-
os: [windows-latest]
24-
# os: [macos-latest, ubuntu-latest, windows-latest]
14+
runs-on: windows-latest
2515

2616
steps:
2717
- name: Checkout Code
@@ -31,6 +21,7 @@ jobs:
3121
uses: actions/setup-node@v3
3222
with:
3323
node-version: 18
24+
cache: 'npm' # 缓存npm依赖加速构建
3425

3526
- name: Install Dependencies
3627
run: npm install
@@ -43,6 +34,6 @@ jobs:
4334
- name: Upload Artifact
4435
uses: actions/upload-artifact@v3
4536
with:
46-
name: release_on_${{ matrix. os }}
37+
name: MagicFn-Windows
4738
path: release/
48-
retention-days: 5
39+
retention-days: 7 # 保留时间延长到7天

.github/workflows/ci.yml

Lines changed: 26 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,38 @@
11
name: CI
22

33
on:
4-
pull_request_target:
5-
branches:
6-
- main
7-
8-
permissions:
9-
pull-requests: write
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
paths-ignore:
9+
- "**.md"
10+
- ".github/**"
11+
- "!.github/workflows/ci.yml"
1012

1113
jobs:
12-
job1:
13-
name: Check Not Allowed File Changes
14-
runs-on: ubuntu-latest
15-
outputs:
16-
markdown_change: ${{ steps.filter_markdown.outputs.change }}
17-
markdown_files: ${{ steps.filter_markdown.outputs.change_files }}
14+
lint-and-test:
15+
runs-on: windows-latest
1816
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v3
1919

20-
- name: Check Not Allowed File Changes
21-
uses: dorny/paths-filter@v2
22-
id: filter_not_allowed
23-
with:
24-
list-files: json
25-
filters: |
26-
change:
27-
- 'package-lock.json'
28-
- 'yarn.lock'
29-
- 'pnpm-lock.yaml'
30-
31-
# ref: https://github.com/github/docs/blob/main/.github/workflows/triage-unallowed-contributions.yml
32-
- name: Comment About Changes We Can't Accept
33-
if: ${{ steps.filter_not_allowed.outputs.change == 'true' }}
34-
uses: actions/github-script@v6
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
3522
with:
36-
script: |
37-
let workflowFailMessage = "It looks like you've modified some files that we can't accept as contributions."
38-
try {
39-
const badFilesArr = [
40-
'package-lock.json',
41-
'yarn.lock',
42-
'pnpm-lock.yaml',
43-
]
44-
const badFiles = badFilesArr.join('\n- ')
45-
const reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n- ${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:\n\nMore discussion:\n- https://github.com/electron-vite/electron-vite-vue/issues/192`
46-
createdComment = await github.rest.issues.createComment({
47-
owner: context.repo.owner,
48-
repo: context.repo.repo,
49-
issue_number: context.payload.number,
50-
body: reviewMessage,
51-
})
52-
workflowFailMessage = `${workflowFailMessage} Please see ${createdComment.data.html_url} for details.`
53-
} catch(err) {
54-
console.log("Error creating comment.", err)
55-
}
56-
core.setFailed(workflowFailMessage)
23+
node-version: 18
24+
cache: 'npm'
5725

58-
- name: Check Not Linted Markdown
59-
if: ${{ always() }}
60-
uses: dorny/paths-filter@v2
61-
id: filter_markdown
62-
with:
63-
list-files: shell
64-
filters: |
65-
change:
66-
- added|modified: '*.md'
26+
- name: Install Dependencies
27+
run: npm install
6728

29+
- name: Lint
30+
run: npm run lint
31+
continue-on-error: true # 即使lint失败也继续执行
6832

69-
job2:
70-
name: Lint Markdown
71-
runs-on: ubuntu-latest
72-
needs: job1
73-
if: ${{ always() && needs.job1.outputs.markdown_change == 'true' }}
74-
steps:
75-
- name: Checkout Code
76-
uses: actions/checkout@v3
77-
with:
78-
ref: ${{ github.event.pull_request.head.sha }}
33+
- name: Type Check
34+
run: npm run typecheck
35+
continue-on-error: true # 即使类型检查失败也继续执行
7936

80-
- name: Lint markdown
81-
run: npx markdownlint-cli ${{ needs.job1.outputs.markdown_files }} --ignore node_modules
37+
- name: Build
38+
run: npm run build:web # 只构建Web部分,速度更快

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 推送标签时触发,如 v1.0.0
7+
8+
jobs:
9+
release:
10+
runs-on: windows-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
cache: 'npm'
20+
21+
- name: Install Dependencies
22+
run: npm install
23+
24+
- name: Build Release Files
25+
run: npm run build
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Create Release
30+
uses: softprops/action-gh-release@v1
31+
with:
32+
files: |
33+
release/*.exe
34+
release/*.zip
35+
draft: true # 创建草稿版本,需要手动发布
36+
generate_release_notes: true # 自动生成发布说明
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/router/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
22
import Home from '../views/Home.vue'
3-
import HelloWorld from '../views/HelloWorld.vue'
43
import Dashboard from '../views/Dashboard.vue'
54
import About from '../views/About.vue'
65
import Suffix from '../views/Suffix.vue'
@@ -25,11 +24,6 @@ const routes = [
2524
name: 'About',
2625
component: About, // 默认视图
2726
},
28-
{
29-
path: 'hello-world',
30-
name: 'HelloWorld',
31-
component: HelloWorld,
32-
},
3327
],
3428
},
3529
];

src/types/components.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,22 @@ declare module 'vue' {
2929
ElTag: typeof import('element-plus/es')['ElTag']
3030
ElTooltip: typeof import('element-plus/es')['ElTooltip']
3131
IEpArrowRightBold: typeof import('~icons/ep/arrow-right-bold')['default']
32+
IEpChatDotRound: typeof import('~icons/ep/chat-dot-round')['default']
3233
IEpDataBoard: typeof import('~icons/ep/data-board')['default']
34+
IEpEdit: typeof import('~icons/ep/edit')['default']
35+
IEpFiles: typeof import('~icons/ep/files')['default']
3336
IEpInfoFilled: typeof import('~icons/ep/info-filled')['default']
3437
IEpMenu: typeof import('~icons/ep/menu')['default']
38+
IEpMonitor: typeof import('~icons/ep/monitor')['default']
39+
IEpMoon: typeof import('~icons/ep/moon')['default']
40+
IEpRefresh: typeof import('~icons/ep/refresh')['default']
41+
IEpRight: typeof import('~icons/ep/right')['default']
3542
IEpSetting: typeof import('~icons/ep/setting')['default']
43+
IEpSunny: typeof import('~icons/ep/sunny')['default']
44+
IEpSwitchButton: typeof import('~icons/ep/switch-button')['default']
45+
IEpTools: typeof import('~icons/ep/tools')['default']
46+
IEpUpload: typeof import('~icons/ep/upload')['default']
47+
IEpView: typeof import('~icons/ep/view')['default']
3648
RouterLink: typeof import('vue-router')['RouterLink']
3749
RouterView: typeof import('vue-router')['RouterView']
3850
}

0 commit comments

Comments
 (0)