diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..b731080 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,47 @@ +name: Deploy website to GitHub Pages + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'sites/**' + - '.github/workflows/pages.yml' + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + deploy: + name: Deploy static website + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v7 + + - name: Validate website + run: | + node sites/scripts/validate.mjs + node --check sites/app.js + + - name: Configure GitHub Pages + uses: actions/configure-pages@v5 + + - name: Upload website artifact + uses: actions/upload-pages-artifact@v4 + with: + path: sites + + - name: Deploy website + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package.json b/package.json index db935e9..ea8c5e7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "description": "Secure desktop AI workspace with controlled Agent Runtimes", "desktopName": "GoodBuddy", - "homepage": "https://github.com/mesalogo/goodbuddy", + "homepage": "https://mesalogo.github.io/goodbuddy/", "author": { "name": "MesaLogo" }, diff --git a/sites/README.md b/sites/README.md index 09f1822..8ba2664 100644 --- a/sites/README.md +++ b/sites/README.md @@ -2,6 +2,17 @@ `sites` 是无需构建步骤或额外依赖的静态官网源码,可直接托管整个目录。 +正式站点地址: + +## 部署 + +`.github/workflows/pages.yml` 会在 `main` 分支中的官网文件发生变化后, +校验并部署整个 `sites` 目录。工作流也支持在 GitHub Actions 中手动运行。 + +首次部署前,需要在 GitHub 仓库的 **Settings > Pages** 中将 **Source** +设为 **GitHub Actions**。站点使用项目 Pages 地址,不需要 `CNAME` 文件 +或自定义域名 DNS 配置。 + ## 本地预览 在仓库根目录运行: diff --git a/sites/index.html b/sites/index.html index e9f19e0..413cd15 100644 --- a/sites/index.html +++ b/sites/index.html @@ -7,6 +7,7 @@ name="description" content="GoodBuddy 是桌面 AI 助手,支持项目知识库、魔法笔记、远程消息通道和受控工具执行。" /> + GoodBuddy|桌面 AI 助手 diff --git a/sites/scripts/validate.mjs b/sites/scripts/validate.mjs index fdc71df..d69578e 100644 --- a/sites/scripts/validate.mjs +++ b/sites/scripts/validate.mjs @@ -56,6 +56,12 @@ for (const [relativePath, content] of [ report(//.test(html), "页面语言必须是 zh-CN"); report(//.test( + html, + ), + "canonical 地址必须指向 GitHub Pages 正式站点", +); report((html.match(/]/g) ?? []).length === 1, "页面必须且只能包含一个 h1"); report(/class="skip-link"\s+href="#main-content"/.test(html), "缺少跳到主要内容链接"); report(//.test(html), "缺少 main-content 主区域");