diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index f3e19972..5006e586 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -19,6 +19,8 @@ jobs:
- uses: utooland/setup-utoo@v1
- run: ut
+ - name: Set COMMIT_HASH
+ run: echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV
- run: ut build
- name: Deploy to GitHub Pages
diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml
index cecc606f..6568c6f3 100644
--- a/.github/workflows/preview-build.yml
+++ b/.github/workflows/preview-build.yml
@@ -18,6 +18,8 @@ jobs:
- uses: utooland/setup-utoo@v1
- run: ut
+ - name: Set COMMIT_HASH
+ run: echo "COMMIT_HASH=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- run: ut build
- name: upload dist artifact
diff --git a/cloudflare-worker/src/data/dashboard.ts b/cloudflare-worker/src/data/dashboard.ts
index 018e0c69..1fde7f44 100644
--- a/cloudflare-worker/src/data/dashboard.ts
+++ b/cloudflare-worker/src/data/dashboard.ts
@@ -191,47 +191,47 @@ export const activities = [
id: 'trend-1',
updatedAt: new Date().toISOString(),
user: { name: '曲丽丽', avatar: avatars2[0] },
- group: { name: '高逼格设计天团', link: 'http://github.com/' },
- project: { name: '六月迭代', link: 'http://github.com/' },
+ group: { name: '高逼格设计天团', link: 'https://github.com/' },
+ project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-2',
updatedAt: new Date().toISOString(),
user: { name: '付小小', avatar: avatars2[1] },
- group: { name: '高逼格设计天团', link: 'http://github.com/' },
- project: { name: '六月迭代', link: 'http://github.com/' },
+ group: { name: '高逼格设计天团', link: 'https://github.com/' },
+ project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-3',
updatedAt: new Date().toISOString(),
user: { name: '林东东', avatar: avatars2[2] },
- group: { name: '中二少女团', link: 'http://github.com/' },
- project: { name: '六月迭代', link: 'http://github.com/' },
+ group: { name: '中二少女团', link: 'https://github.com/' },
+ project: { name: '六月迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
{
id: 'trend-4',
updatedAt: new Date().toISOString(),
user: { name: '周星星', avatar: avatars2[4] },
- project: { name: '5 月日常迭代', link: 'http://github.com/' },
+ project: { name: '5 月日常迭代', link: 'https://github.com/' },
template: '将 @{project} 更新至已发布状态',
},
{
id: 'trend-5',
updatedAt: new Date().toISOString(),
user: { name: '朱偏右', avatar: avatars2[3] },
- project: { name: '工程效能', link: 'http://github.com/' },
- comment: { name: '留言', link: 'http://github.com/' },
+ project: { name: '工程效能', link: 'https://github.com/' },
+ comment: { name: '留言', link: 'https://github.com/' },
template: '在 @{project} 发布了 @{comment}',
},
{
id: 'trend-6',
updatedAt: new Date().toISOString(),
user: { name: '乐哥', avatar: avatars2[5] },
- group: { name: '程序员日常', link: 'http://github.com/' },
- project: { name: '品牌迭代', link: 'http://github.com/' },
+ group: { name: '程序员日常', link: 'https://github.com/' },
+ project: { name: '品牌迭代', link: 'https://github.com/' },
template: '在 @{group} 新建项目 @{project}',
},
];
diff --git a/cloudflare-worker/src/routes/list.ts b/cloudflare-worker/src/routes/list.ts
index b9536914..c2f75ab2 100644
--- a/cloudflare-worker/src/routes/list.ts
+++ b/cloudflare-worker/src/routes/list.ts
@@ -84,8 +84,8 @@ function fakeList(count: number) {
percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8],
href: 'https://ant.design',
- updatedAt: new Date().getTime() - Math.floor(Math.random() * 1000000000),
- createdAt: new Date().getTime() - Math.floor(Math.random() * 1000000000),
+ updatedAt: Date.now() - Math.floor(Math.random() * 1000000000),
+ createdAt: Date.now() - Math.floor(Math.random() * 1000000000),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的共通点和组成部分,该专案即是致力于归纳和吸收各种产品的各自优势,致力于打造成中后台产品的根底',
diff --git a/config/config.ts b/config/config.ts
index 71549946..f9c022a5 100644
--- a/config/config.ts
+++ b/config/config.ts
@@ -18,6 +18,9 @@ const { UMI_ENV = 'dev' } = process.env;
const PUBLIC_PATH: string = '/';
export default defineConfig({
+ alias: {
+ '@root': join(__dirname, '..'),
+ },
/**
* @name 开启 hash 模式
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
@@ -190,6 +193,8 @@ export default defineConfig({
exportStatic: {},
define: {
'process.env.CI': process.env.CI,
+ 'process.env.COMMIT_HASH': process.env.COMMIT_HASH || '',
+ 'process.env.CF_PAGES_COMMIT_SHA': process.env.CF_PAGES_COMMIT_SHA || '',
},
extraPostCSSPlugins: [tailwindcss],
});
diff --git a/package.json b/package.json
index d7cf5537..f70540cc 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"antd-style": "^4.1.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.19",
+ "git-url-parse": "^16.1.0",
"numeral": "^2.0.6",
"react": "^19.2.4",
"react-dom": "^19.2.4"
@@ -67,6 +68,8 @@
"@types/react-helmet": "^6.1.11",
"@umijs/lint": "^4.6.40",
"@umijs/max": "^4.6.40",
+ "@umijs/max-plugin-openapi": "^2.0.3",
+ "@umijs/request-record": "^1.1.3",
"cross-env": "^10.1.0",
"express": "^5.2.1",
"gh-pages": "^6.1.1",
@@ -78,8 +81,6 @@
"tailwindcss": "^4",
"ts-node": "^10.9.2",
"typescript": "^6.0.2",
- "@umijs/max-plugin-openapi": "^2.0.3",
- "@umijs/request-record": "^1.1.3",
"umi-serve": "^1.9.11"
},
"engines": {
diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx
index 1ceebe42..ed70d0c3 100644
--- a/src/components/Footer/index.tsx
+++ b/src/components/Footer/index.tsx
@@ -1,31 +1,57 @@
import { GithubOutlined } from '@ant-design/icons';
import { DefaultFooter } from '@ant-design/pro-components';
+import packageJson from '@root/package.json';
+import GitUrlParse from 'git-url-parse';
import React from 'react';
+const getRepoUrl = () => {
+ if (!packageJson.repository)
+ return 'https://github.com/ant-design/ant-design-pro';
+ const parsed = GitUrlParse(packageJson.repository);
+ return `https://${parsed.source}/${parsed.owner}/${parsed.name}`;
+};
+
+const REPO = getRepoUrl();
+
+// Git commit hash, can be updated via CI/CD (GitHub Actions or Cloudflare Pages)
+const COMMIT_HASH =
+ process.env.COMMIT_HASH || process.env.CF_PAGES_COMMIT_SHA || '';
+
const Footer: React.FC = () => {
+ const commitUrl = COMMIT_HASH ? `${REPO}/commit/${COMMIT_HASH}` : undefined;
+
return (