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
28 changes: 22 additions & 6 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
concurrency:
group: cos-upload-${{ github.repository }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'production' }}
cancel-in-progress: false
queue: max

jobs:
test:
Expand Down Expand Up @@ -48,7 +49,6 @@ jobs:
- name: Validate Calcit snapshot and types
run: |
set -euo pipefail
test "$(calcit --version)" = "0.27.0"
test -f calcit.cirru
test -f deps.cirru
test ! -e compact.cirru
Expand Down Expand Up @@ -83,9 +83,24 @@ jobs:
yarn build
node --test test/runtime.test.mjs

- name: Check current production revision
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: production
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
current_sha="$(gh api "repos/${GITHUB_REPOSITORY}/commits/main" --jq '.sha')"
if [[ "$GITHUB_SHA" == "$current_sha" ]]; then
echo "current=true" >> "$GITHUB_OUTPUT"
else
echo "current=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skip stale production revision ${GITHUB_SHA}; current main is ${current_sha}."
fi

- name: Check COS credentials
id: cos-credentials
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
if: steps.production.outputs.current == 'true' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
env:
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
Expand All @@ -105,7 +120,8 @@ jobs:

- name: Upload and verify static assets on COS
if: steps.cos-credentials.outputs.available == 'true'
uses: worktools/cos-upload-action@17e6d213fe9f6772a6090a13c8ba044cd6cbcb09 # v1.1.1
timeout-minutes: 10
uses: worktools/cos-upload-action@06d6027dcca6413c5936e04a9b6e9f0d5ef71ba0 # v1.2.0
with:
source-dir: dist
bucket: ${{ secrets.COS_BUCKET }}
Expand All @@ -116,7 +132,7 @@ jobs:
secret-key: ${{ secrets.COS_SECRET_KEY }}

- name: Install verified rsync
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.production.outputs.current == 'true'
run: |
curl --fail --location --silent --show-error \
--output "$RUNNER_TEMP/rsync.tar.gz" \
Expand All @@ -137,7 +153,7 @@ jobs:
echo "$RUNNER_TEMP/rsync-install/bin" >> "$GITHUB_PATH"

- name: Configure verified SSH host
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.production.outputs.current == 'true'
env:
DEPLOY_KEY: ${{ secrets.rsync_private_key }}
run: |
Expand All @@ -148,7 +164,7 @@ jobs:
chmod 600 "$HOME/.ssh/known_hosts"

- name: Deploy web app
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.production.outputs.current == 'true'
run: |
rsync -avzr --progress \
-e "ssh -i $HOME/.ssh/deploy_key -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts" \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ node --test test/runtime.test.mjs

##### 目录结构

dev 先生成初始 JS,再共同运行 Calcit watch 和 Vite;任一进程退出时停止另一。build 包含一次编译。未设置 `VITE_BASE_URL` 时保持相对资源路径,每次 PR 上传按 PR/run/attempt 隔离。上传及公开访问验证仅使用 COS Action 内置 verify 配置,删除独立 CDN 校验脚本。CI 保留严格入口/公共合同、原质量基线和真实业务测试,不重复运行迁移诊断。原语音模式、存储键、共享字体和服务器部署路径不变。
dev 先生成初始 JS,再启动 Vite;修改 Calcit 时在另一终端运行 `yarn watch`,无需进程管理依赖。build 包含一次编译。未设置 `VITE_BASE_URL` 时保持相对资源路径,每次 PR 上传按 PR/run/attempt 隔离。上传及公开访问验证仅使用 COS Action v1.2.0 内置 verify 配置,不添加独立 CDN 校验脚本。生产部署排队执行,上传前检查仍为当前 main,过期构建跳过 COS 和原服务器同步。CI 保留严格入口/公共合同、原质量基线和真实业务测试,不重复运行迁移诊断。原语音模式、存储键、共享字体和服务器部署路径不变。

Markdown 0.4.46 的行内代码渲染修复 [上游 #61](https://github.com/Respo/respo-markdown.calcit/pull/61) 已合并;在正式版本发布前固定完整提交 `1256d550445bf69573bc9e53bbccbea1ddcb0530`,不把该提交冒充已发布版本。运行测试使用真实编译组件及 SDK 导入,浏览器 Worker/DOM/语音宿主使用 fixture,不会请求付费 TTS,也不代表现场语音服务验收。

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"packageManager": "yarn@4.18.0",
"scripts": {
"compile": "calcit calcit.cirru js",
"compile": "calcit",
"watch": "calcit -w",
"build": "yarn compile && vite build",
"release": "yarn build",
"dev": "yarn compile && concurrently --kill-others \"calcit calcit.cirru js -w\" \"vite\""
"dev": "yarn compile && vite"
},
"dependencies": {
"@calcit/procs": "0.27.0",
Expand All @@ -17,7 +18,6 @@
},
"devDependencies": {
"bottom-tip": "^0.1.5",
"concurrently": "^10.0.5",
"crypto-js": "^4.2.0",
"feather-icons": "^4.29.1",
"js-base64": "^3.7.5",
Expand Down
176 changes: 0 additions & 176 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.