YD-WEB/OSS-DEPLOY.md
2026-07-27 16:44:06 +08:00

33 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 阿里云 OSS 发布
在项目根目录打开 PowerShell,执行:
```powershell
npm run deploy:oss
```
脚本会自动完成以下操作:
1. 使用当前时间生成 `static/wwwweb/yyyyMMdd-HHmmss/` 目录。
2. 执行 Vue/Vite 生产构建。
3. 改写并检查 OSS 静态资源地址,阻止重复 `https://...https://...` 地址上传。
4. 上传 JS、CSS、图片等静态资源,并排除 `index.html`。
5. 验证线上 JS、CSS、Logo 可访问,同时确认 OSS 中不存在 `index.html`。
构建完成后,将终端输出的 `Server index` 文件部署到 `www.yuedongsports.com` 服务器。
## 前置配置
- AccessKey 配置文件:`C:\Users\当前用户\.ossutilconfig`
- ossutil 默认位置:`.tools\ossutil-2.3.0-windows-amd64\ossutil.exe`
如果路径不同,可以直接调用脚本并传入参数:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\deploy-oss.ps1 `
-ConfigFile "D:\secure\.ossutilconfig" `
-OssutilPath "D:\tools\ossutil.exe"
```
仅在网络环境无法执行公网校验时,可增加 `-SkipRemoteVerify`;上传和本地路径检查仍会正常执行。