ci: add build verification workflow

This commit is contained in:
Timi
2026-11-06 17:53:41 +08:00
parent a32aaef8ae
commit ae5645e9fc
3 changed files with 246 additions and 1 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
VITE_APP_TITLE=Gao Customer H5
VITE_USE_LOCAL_TIMI_WEB=true
VITE_API_BASE_URL=http://localhost:8091
VITE_API_BASE_URL=http://localhost:18091
+62
View File
@@ -0,0 +1,62 @@
name: Build
# 当前阶段只做构建验证:不部署 nginx、不发 Release
# 热更新包与生产部署在后续阶段以独立 workflow 接入
on:
pull_request:
branches:
- master
types:
- closed
workflow_dispatch:
jobs:
build:
runs-on: act_runner_node
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure nexus auth
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if [ -z "$NEXUS_USERNAME" ] || [ -z "$NEXUS_PASSWORD" ]; then
echo "FAIL: 缺少 secrets.NEXUS_USERNAME 或 secrets.NEXUS_PASSWORD"
exit 1
fi
auth=$(printf '%s:%s' "$NEXUS_USERNAME" "$NEXUS_PASSWORD" | base64 | tr -d '\n')
{
echo "registry=https://nexus.imyeyu.com/repository/npm-group/"
echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-group/:always-auth=true"
echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${auth}"
echo "//nexus.imyeyu.com/repository/npm-timi/:always-auth=true"
} > ~/.npmrc
echo "OK: nexus 认证已配置"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Report output
run: |
echo "dist 大小: $(du -sh dist | cut -f1)"
echo "文件数: $(find dist -type f | wc -l)"
if [ -f dist/index.html ]; then
echo "index.html: 存在"
else
echo "FAIL: dist/index.html 缺失,产物不可用于热更新"
exit 1
fi
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 7
+183
View File
@@ -0,0 +1,183 @@
<template>
<bottom-popup
v-model="popupVisible"
:title="title"
height="80vh"
left-button-text="关闭"
right-button-text=""
@left-button-click="close"
>
<div class="managed-user-selector">
<div class="search-wrap">
<t-input
v-model.trim="keyword"
class="search"
borderless
clearable
placeholder="搜索姓名、昵称或手机号"
/>
</div>
<t-cell-group v-if="filteredUserList.length" class="list">
<t-cell
v-for="item in filteredUserList"
:key="item.id || item.userId"
class="item"
:title="getUserName(item)"
:description="getUserDescription(item)"
@click="select(item)"
>
<template #left-icon>
<t-checkbox
:model-value="item.userId === modelValue"
borderless
@change="select(item)"
/>
</template>
</t-cell>
</t-cell-group>
<div v-else class="center-tips" v-text="loading ? '正在加载负责人' : '暂无可选负责人'" />
</div>
</bottom-popup>
</template>
<script setup lang="ts">
import { BottomPopup } from "timi-tdesign-mobile";
import ManagedUserAPI from "@/api/ManagedUserAPI";
import { getErrorMessage } from "@/utils/error";
import { Message } from "@/utils/message";
import type { ManagedUser } from "@/types/ManagedUser";
interface Props {
modelValue: string;
visible: boolean;
storeId?: string;
title?: string;
}
const props = withDefaults(defineProps<Props>(), {
storeId: "",
title: "选择负责人"
});
const emit = defineEmits<{
"update:modelValue": [value: string];
"update:visible": [value: boolean];
change: [value: ManagedUser];
}>();
const popupVisible = computed({
get: () => props.visible,
set: value => emit("update:visible", value)
});
const keyword = ref("");
const loading = ref(false);
const userList = ref<ManagedUser[]>([]);
const filteredUserList = computed(() => {
const normalizedKeyword = keyword.value.toLowerCase();
return userList.value.filter(item => {
const user = item.user;
return !normalizedKeyword || [item.userId, user?.name, user?.nick, user?.phoneNo]
.some(value => Boolean(value?.toLowerCase().includes(normalizedKeyword)));
});
});
function getUserName(item: ManagedUser): string {
return item.user?.nick || item.user?.name || item.userId || "未命名用户";
}
function getUserDescription(item: ManagedUser): string {
const phone = item.user?.phoneNo || "未填写手机号";
const verified = item.user?.phoneNoVerified ? "已验证" : "未验证";
return `${phone} · ${verified}`;
}
async function loadUsers(): Promise<void> {
loading.value = true;
try {
const result = await ManagedUserAPI.list({
index: 0,
size: 1000,
equalsExample: {
storeId: props.storeId || undefined,
enabled: true
}
}, {
storeId: props.storeId || undefined
});
userList.value = result.list || [];
} catch (error) {
userList.value = [];
Message.error(getErrorMessage(error, "负责人列表加载失败"));
} finally {
loading.value = false;
}
}
function select(item: ManagedUser): void {
if (!item.userId) {
return;
}
emit("update:modelValue", item.userId);
emit("change", item);
emit("update:visible", false);
}
function close(): void {
emit("update:visible", false);
}
watch(() => props.visible, async value => {
if (!value) {
keyword.value = "";
return;
}
await loadUsers();
});
watch(() => props.storeId, async () => {
if (props.visible) {
await loadUsers();
}
});
</script>
<style scoped lang="less">
.managed-user-selector {
height: 100%;
overflow: auto;
background: var(--td-bg-color-page, #f5f5f8);
.search-wrap {
padding: .75rem 1rem;
background: var(--td-bg-color-container, #fff);
}
.search {
--td-input-vertical-padding: 8px 14px;
border: 1px solid var(--td-component-border);
border-radius: .75rem;
}
.item {
padding: .25rem 1rem;
}
}
:global(html.theme-dark) {
.managed-user-selector {
background: #10161f;
.search-wrap,
.item {
background: rgba(30, 41, 59, .9);
}
.search {
background: rgba(15, 23, 42, .72);
border-color: rgba(148, 163, 184, .16);
}
}
}
</style>