Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Test and preview PulseZone

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
test:
name: Test static site
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Run tests
run: npm test
- name: Check JavaScript syntax
run: |
node --check app.js
node --check calculations.mjs
- name: Prepare preview artifact
uses: actions/upload-artifact@v4
with:
name: pulsezone-preview-${{ github.sha }}
path: |
index.html
app.js
calculations.mjs
styles.css
README.md
if-no-files-found: error
retention-days: 14

deploy:
name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload site
uses: actions/upload-pages-artifact@v3
with:
path: .
- name: Deploy site
id: deployment
uses: actions/deploy-pages@v4
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ python3 -m http.server 4173
npm test
```

## GitHub Actions 预览与发布

仓库包含 GitHub Actions 工作流 `.github/workflows/deploy-pages.yml`:

- 每次 Pull Request 和手动运行都会执行测试、语法检查,并上传一个可下载的预览构建产物;
- 合并到 `main` 后会自动发布到 GitHub Pages;
- 在 GitHub 的 **Actions** 页面打开对应运行记录,可在 **Artifacts** 下载预览文件;
- 首次发布前,在仓库 **Settings → Pages** 将发布来源设置为 **GitHub Actions**。

发布后,工作流运行详情页会显示 GitHub Pages 的预览地址。

## 说明

计算结果用于训练规划参考,不替代医生或专业教练建议。运动场景会影响训练感受、测量稳定性和目标设置,实际训练应结合设备、主观体感和专业建议校准。
Loading