Skip to content

Commit 02e1835

Browse files
committed
2 parents e591e6a + bb1080e commit 02e1835

File tree

5 files changed

+128
-18
lines changed

5 files changed

+128
-18
lines changed

.github/workflows/deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy to Target Repo on Version Change
2+
3+
on:
4+
push:
5+
paths:
6+
- "package.json" # 仅在 package.json 更新时触发
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Step 1: 检出源仓库代码
14+
- name: Checkout Source Repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0 # 拉取完整历史记录
18+
19+
# Step 2: 检查 package.json 的版本号是否变化
20+
- name: Check for Version Change
21+
id: version
22+
run: |
23+
if [ "$(git rev-list --count HEAD)" -eq 1 ]; then
24+
echo "No previous commit, setting version_changed to true."
25+
echo "version_changed=true" >> $GITHUB_ENV
26+
else
27+
OLD_VERSION=$(git show HEAD~1:package.json | jq -r .version)
28+
NEW_VERSION=$(jq -r .version package.json)
29+
echo "Old version: $OLD_VERSION"
30+
echo "New version: $NEW_VERSION"
31+
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
32+
echo "version_changed=true" >> $GITHUB_ENV
33+
else
34+
echo "version_changed=false" >> $GITHUB_ENV
35+
fi
36+
fi
37+
# Step 3: 如果版本号改变,则拉取目标仓库并执行 gh 指令
38+
- name: Deploy to Target Repo
39+
if: env.version_changed == 'true'
40+
env:
41+
TARGET_REPO_TOKEN: ${{ secrets.TARGET_REPO_TOKEN }}
42+
run: |
43+
# 克隆目标仓库
44+
git clone https://x-access-token:${TARGET_REPO_TOKEN}@github.com/VueFilesPreview/vue-files-preview-demo.git vue-files-preview-demo
45+
# 进入目标仓库目录
46+
cd vue-files-preview-demo
47+
# 安装依赖
48+
npm install
49+
# 确保脚本有执行权限
50+
npm run gh
51+
52+
# 提交并推送更改(如果脚本有更改内容)
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add .
56+
git commit -m "feat: Auto-deploy on version change to $NEW_VERSION" || echo "No changes to commit"
57+
git push

.github/workflows/release-cdn.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 仅在推送匹配 'v*' 的标签时触发
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Step 1: 检出代码
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
# Step 2: 设置 Node.js 环境(根据需要调整 Node.js 版本)
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '16' # 您的项目需要的 Node.js 版本
22+
23+
# Step 3: 安装依赖并构建项目
24+
- name: Install dependencies and build
25+
run: |
26+
npm install
27+
npm run build # 运行构建命令
28+
29+
# Step 4: 创建 Release 并上传构建文件
30+
- name: Create Release
31+
id: create_release
32+
uses: actions/create-release@v1
33+
with:
34+
tag_name: ${{ github.ref_name }}
35+
release_name: Release ${{ github.ref_name }}
36+
draft: false
37+
prerelease: false
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Upload Build Artifacts
42+
uses: actions/upload-release-asset@v1
43+
with:
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
asset_path: ./dist # 构建输出的目录
46+
asset_name: dist.zip # 将构建的目录压缩为一个 ZIP 文件
47+
asset_content_type: application/zip

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"build": "vite build",
4141
"preview": "vite preview",
4242
"unpub": "npm unpublish",
43-
"pub": "cd dist && npm publish --access=public"
43+
"pub": "cd dist && npm publish --access=public --registry=https://registry.npmjs.com"
4444
},
4545
"publishConfig": {
4646
"access": "public"
@@ -52,32 +52,32 @@
5252
"@codemirror/theme-one-dark": "6.1.2",
5353
"@vue-office/docx": "1.6.2",
5454
"@vue-office/excel": "1.7.8",
55-
"@vueuse/core": "11.1.0",
55+
"@vueuse/core": "11.2.0",
56+
"codemirror": "^6.0.1",
5657
"epubjs": "0.3.93",
5758
"highlight.js": "11.10.0",
5859
"markdown-it": "14.1.0",
5960
"markdown-it-container": "4.0.0",
6061
"markdown-it-footnote": "4.0.0",
61-
"vue": "3.5.11",
62+
"vue": "3.5.12",
6263
"vue-codemirror": "6.1.1",
6364
"vue-demi": "0.14.8"
6465
},
6566
"devDependencies": {
66-
"@antfu/eslint-config": "2.26.0",
67-
"@rollup/plugin-typescript": "12.1.0",
68-
"@types/node": "22.7.4",
67+
"@antfu/eslint-config": "3.8.0",
68+
"@rollup/plugin-typescript": "12.1.1",
69+
"@types/node": "22.9.0",
6970
"@vitejs/plugin-vue": "5.1.4",
70-
"eslint": "9.12.0",
71+
"eslint": "9.14.0",
7172
"npm-run-all": "4.1.5",
7273
"rimraf": "6.0.1",
73-
"sass": "1.79.4",
74+
"sass": "1.81.0",
7475
"ts-node": "10.9.2",
75-
"tslib": "2.7.0",
76-
"unplugin-auto-import": "0.18.3",
76+
"tslib": "2.8.1",
7777
"tsx": "4.19.1",
7878
"unplugin-auto-import": "0.18.3",
79-
"vite": "5.4.8",
80-
"vite-plugin-dts": "4.2.3",
79+
"vite": "5.4.10",
80+
"vite-plugin-dts": "4.3.0",
8181
"vite-tsconfig-paths": "5.0.1"
8282
},
8383
"browserslist": [

packages/auto-imports.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ declare global {
6767
// for type re-export
6868
declare global {
6969
// @ts-ignore
70-
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
70+
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
7171
import('vue')
7272
}

packages/preview/supports/video-preview/index.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ onBeforeUnmount(() => {
5757
top: 0;
5858
width: 100vw !important;
5959
height: 100vh !important;
60-
overflow: auto;
60+
overflow: hidden; /* 隐藏溢出内容,保持全屏体验 */
61+
background: rgba(0, 0, 0, 0.8); /* 背景色可提高视频对比度 */
62+
display: flex; /* 使用 flexbox 来居中视频 */
63+
align-items: center; /* 垂直居中 */
64+
justify-content: center; /* 水平居中 */
6165
}
6266
6367
.player-video-main {
6468
width: 100%;
65-
object-fit: scale-down;
69+
height: auto; /* 使视频保持宽高比 */
70+
max-height: 100%; /* 限制最大高度以防溢出 */
71+
object-fit: contain; /* 保持宽高比,可能会出现黑边 */
6672
transition: .2s;
73+
}
6774
68-
&.video-mirror {
69-
transform: rotateY(180deg);
70-
}
75+
.player-video-main.video-mirror {
76+
transform: rotateY(180deg);
7177
}
7278
</style>

0 commit comments

Comments
 (0)