feat: point production host at project57 embed JS [deploy]
This commit is contained in:
1 parent
076e603c93
commit
f717f1d481
4 files changed
+14
-10
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# A 站(project57)线上源站。构建时写入,B 站用它加载 aurora.js / 图片 / 表单 API。
|
||||||
|
VITE_A_ORIGIN=https://swissicapital.net
|
||||||
@@ -130,10 +130,10 @@ jobs:
|
|||||||
VITE_A_ORIGIN: ${{ secrets.VITE_A_ORIGIN }}
|
VITE_A_ORIGIN: ${{ secrets.VITE_A_ORIGIN }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${VITE_A_ORIGIN}" ]; then
|
if [ -z "${VITE_A_ORIGIN}" ]; then
|
||||||
echo "❌ 未配置 Secret VITE_A_ORIGIN(A 站源站,如 https://swissicapital.net)"
|
echo "ℹ️ Secret VITE_A_ORIGIN 未配置,改用 .env.production"
|
||||||
exit 1
|
else
|
||||||
|
echo "VITE_A_ORIGIN=${VITE_A_ORIGIN}"
|
||||||
fi
|
fi
|
||||||
echo "VITE_A_ORIGIN=${VITE_A_ORIGIN}"
|
|
||||||
pnpm build
|
pnpm build
|
||||||
echo "✅ Build completed"
|
echo "✅ Build completed"
|
||||||
if [ -d "dist" ] && [ -f "dist/index.html" ]; then
|
if [ -d "dist" ] && [ -f "dist/index.html" ]; then
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ CI 对齐 **project0**(本地 `projectBase`):提交信息带 `[deploy]`
|
|||||||
|
|
||||||
- `LFS_PAT`
|
- `LFS_PAT`
|
||||||
- `KUBECONFIG_BASE64`
|
- `KUBECONFIG_BASE64`
|
||||||
- `VITE_A_ORIGIN`:A 站线上源站,如 `https://swissicapital.net`
|
- `VITE_A_ORIGIN`(可选):覆盖 `.env.production` 里的 A 站地址
|
||||||
|
- 默认生产源站:`https://swissicapital.net`(加载 `/embed/aurora.js`)
|
||||||
|
|
||||||
|
A 站需已部署嵌入包(`pnpm build` 会先跑 `build:embed`)。
|
||||||
|
|
||||||
## 本地运行
|
## 本地运行
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -1,7 +1,6 @@
|
|||||||
const A_ORIGIN = (import.meta.env.VITE_A_ORIGIN || "http://localhost:3000").replace(
|
const A_ORIGIN = (
|
||||||
/\/$/,
|
import.meta.env.VITE_A_ORIGIN || "https://swissicapital.net"
|
||||||
""
|
).replace(/\/$/, "");
|
||||||
);
|
|
||||||
|
|
||||||
const errorEl = document.getElementById("aurora-error");
|
const errorEl = document.getElementById("aurora-error");
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ function loadScript(src: string): Promise<void> {
|
|||||||
|
|
||||||
async function boot() {
|
async function boot() {
|
||||||
try {
|
try {
|
||||||
await loadScript(`${A_ORIGIN}/embed/aurora.js`);
|
await loadScript(`${A_ORIGIN}/embed/aurora.js?v=1`);
|
||||||
} catch {
|
} catch {
|
||||||
showError(
|
showError(
|
||||||
`无法加载 A 站脚本:${A_ORIGIN}/embed/aurora.js。请先在 project57 执行 pnpm build:embed 并启动 A 站,或修改 .env 中的 VITE_A_ORIGIN。`
|
`无法加载 A 站脚本:${A_ORIGIN}/embed/aurora.js。请先在 project57 执行 pnpm build:embed 并启动 A 站,或修改 .env 中的 VITE_A_ORIGIN。`
|
||||||
@@ -41,7 +40,7 @@ async function boot() {
|
|||||||
api.mount("#aurora-root", {
|
api.mount("#aurora-root", {
|
||||||
assetBase: A_ORIGIN,
|
assetBase: A_ORIGIN,
|
||||||
apiBase: A_ORIGIN,
|
apiBase: A_ORIGIN,
|
||||||
cssUrl: `${A_ORIGIN}/embed/aurora.css`,
|
cssUrl: `${A_ORIGIN}/embed/aurora.css?v=1`,
|
||||||
history: "hash",
|
history: "hash",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user