From 1c160707aa05d8d8c0c20bdbd6ceb81824e5faff Mon Sep 17 00:00:00 2001 From: tiye Date: Fri, 2 Oct 2026 10:43:27 +0800 Subject: [PATCH] Upgrade built-in COS verification and simplify development --- .github/workflows/upload.yaml | 28 ++++-- README.md | 2 +- package.json | 6 +- yarn.lock | 176 ---------------------------------- 4 files changed, 26 insertions(+), 186 deletions(-) diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index b75f1d8..08823dc 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -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: @@ -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 @@ -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 }} @@ -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 }} @@ -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" \ @@ -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: | @@ -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" \ diff --git a/README.md b/README.md index fa7c7a1..e13c612 100644 --- a/README.md +++ b/README.md @@ -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,也不代表现场语音服务验收。 diff --git a/package.json b/package.json index 634b55d..da671a5 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/yarn.lock b/yarn.lock index bae9d9e..e40b02c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -211,20 +211,6 @@ __metadata: languageName: node linkType: hard -"ansi-regex@npm:^6.2.2": - version: 6.4.0 - resolution: "ansi-regex@npm:6.4.0" - checksum: 10c0/e42f68ffa21aac4c4de27aad601bb5ea415b5a07b127681ef44728195f22231b77bc39230ce0c976420d84650b7bf5a5b60eb4e7500c1f74e9a3f3cd4a68f3f6 - languageName: node - linkType: hard - -"ansi-styles@npm:^6.2.1": - version: 6.2.3 - resolution: "ansi-styles@npm:6.2.3" - checksum: 10c0/23b8a4ce14e18fb854693b95351e286b771d23d8844057ed2e7d083cd3e708376c3323707ec6a24365f7d7eda3ca00327fe04092e29e551499ec4c8b7bfac868 - languageName: node - linkType: hard - "bent@npm:^7.3.12": version: 7.3.12 resolution: "bent@npm:7.3.12" @@ -283,13 +269,6 @@ __metadata: languageName: node linkType: hard -"chalk@npm:5.6.2": - version: 5.6.2 - resolution: "chalk@npm:5.6.2" - checksum: 10c0/99a4b0f0e7991796b1e7e3f52dceb9137cae2a9dfc8fc0784a550dc4c558e15ab32ed70b14b21b52beb2679b4892b41a0aa44249bcb996f01e125d58477c6976 - languageName: node - linkType: hard - "chownr@npm:^3.0.0": version: 3.0.0 resolution: "chownr@npm:3.0.0" @@ -311,34 +290,6 @@ __metadata: languageName: node linkType: hard -"cliui@npm:^9.0.1": - version: 9.0.1 - resolution: "cliui@npm:9.0.1" - dependencies: - string-width: "npm:^7.2.0" - strip-ansi: "npm:^7.1.0" - wrap-ansi: "npm:^9.0.0" - checksum: 10c0/13441832e9efe7c7a76bd2b8e683555c478d461a9f249dc5db9b17fe8d4b47fa9277b503914b90bd00e4a151abb6b9b02b2288972ffe2e5e3ca40bcb1c2330d3 - languageName: node - linkType: hard - -"concurrently@npm:^10.0.5": - version: 10.0.5 - resolution: "concurrently@npm:10.0.5" - dependencies: - chalk: "npm:5.6.2" - rxjs: "npm:7.8.2" - shell-quote: "npm:1.9.0" - supports-color: "npm:10.2.2" - tree-kill: "npm:1.2.2" - yargs: "npm:18.0.0" - bin: - conc: dist/bin/index.js - concurrently: dist/bin/index.js - checksum: 10c0/2e66ece2f2a016b4f8b175f88f67d84bbedc8eff864310d37fe8c82e58459a40cfe69c5f0fe8ce9fc97f028157d7adb1c71629433e305e95f447a7840e417ad9 - languageName: node - linkType: hard - "copy-text-to-clipboard@npm:^3.2.2": version: 3.2.2 resolution: "copy-text-to-clipboard@npm:3.2.2" @@ -393,13 +344,6 @@ __metadata: languageName: node linkType: hard -"emoji-regex@npm:^10.3.0": - version: 10.6.0 - resolution: "emoji-regex@npm:10.6.0" - checksum: 10c0/1e4aa097bb007301c3b4b1913879ae27327fdc48e93eeefefe3b87e495eb33c5af155300be951b4349ff6ac084f4403dc9eff970acba7c1c572d89396a9a32d7 - languageName: node - linkType: hard - "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -418,13 +362,6 @@ __metadata: languageName: node linkType: hard -"escalade@npm:^3.1.1": - version: 3.2.0 - resolution: "escalade@npm:3.2.0" - checksum: 10c0/ced4dd3a78e15897ed3be74e635110bbf3b08877b0a41be50dcb325ee0e0b5f65fc2d50e9845194d7c4633f327e2e1c6cce00a71b617c5673df0374201d67f65 - languageName: node - linkType: hard - "ev-store@npm:^7.0.0": version: 7.0.0 resolution: "ev-store@npm:7.0.0" @@ -482,20 +419,6 @@ __metadata: languageName: node linkType: hard -"get-caller-file@npm:^2.0.5": - version: 2.0.5 - resolution: "get-caller-file@npm:2.0.5" - checksum: 10c0/c6c7b60271931fa752aeb92f2b47e355eac1af3a2673f47c9589e8f8a41adc74d45551c1bc57b5e66a80609f10ffb72b6f575e4370d61cc3f7f3aaff01757cde - languageName: node - linkType: hard - -"get-east-asian-width@npm:^1.0.0": - version: 1.7.0 - resolution: "get-east-asian-width@npm:1.7.0" - checksum: 10c0/680a5f611a186e4a065291f31821f7e4ad7742625be814e05b8ab5535c6fa53562bc0333a83138fca5f2e1030ed960a561b2fd4629e0cff0dc68b19cf46d7c53 - languageName: node - linkType: hard - "global@npm:^4.3.0": version: 4.4.0 resolution: "global@npm:4.4.0" @@ -896,7 +819,6 @@ __metadata: "@ltd/j-toml": "npm:^1.38.0" bottom-tip: "npm:^0.1.5" cirru-color: "npm:^0.2.4" - concurrently: "npm:^10.0.5" copy-text-to-clipboard: "npm:^3.2.2" crypto-js: "npm:^4.2.0" dayjs: "npm:^1.11.13" @@ -909,15 +831,6 @@ __metadata: languageName: unknown linkType: soft -"rxjs@npm:7.8.2": - version: 7.8.2 - resolution: "rxjs@npm:7.8.2" - dependencies: - tslib: "npm:^2.1.0" - checksum: 10c0/1fcd33d2066ada98ba8f21fcbbcaee9f0b271de1d38dc7f4e256bfbc6ffcdde68c8bfb69093de7eeb46f24b1fb820620bf0223706cff26b4ab99a7ff7b2e2c45 - languageName: node - linkType: hard - "semver@npm:^7.3.5": version: 7.8.5 resolution: "semver@npm:7.8.5" @@ -927,13 +840,6 @@ __metadata: languageName: node linkType: hard -"shell-quote@npm:1.9.0": - version: 1.9.0 - resolution: "shell-quote@npm:1.9.0" - checksum: 10c0/a39960107eb086b02394cfceb3c732bd3bf567b568719ff47101448fc3f1bf4a59ecfdd8960ff7ea564d749ef8bda70f2c82a768f22d8c7aeeabf2b64f53b7e8 - languageName: node - linkType: hard - "source-map-js@npm:^1.2.1": version: 1.2.1 resolution: "source-map-js@npm:1.2.1" @@ -948,33 +854,6 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^7.0.0, string-width@npm:^7.2.0": - version: 7.2.0 - resolution: "string-width@npm:7.2.0" - dependencies: - emoji-regex: "npm:^10.3.0" - get-east-asian-width: "npm:^1.0.0" - strip-ansi: "npm:^7.1.0" - checksum: 10c0/eb0430dd43f3199c7a46dcbf7a0b34539c76fe3aa62763d0b0655acdcbdf360b3f66f3d58ca25ba0205f42ea3491fa00f09426d3b7d3040e506878fc7664c9b9 - languageName: node - linkType: hard - -"strip-ansi@npm:^7.1.0": - version: 7.2.0 - resolution: "strip-ansi@npm:7.2.0" - dependencies: - ansi-regex: "npm:^6.2.2" - checksum: 10c0/544d13b7582f8254811ea97db202f519e189e59d35740c46095897e254e4f1aa9fe1524a83ad6bc5ad67d4dd6c0281d2e0219ed62b880a6238a16a17d375f221 - languageName: node - linkType: hard - -"supports-color@npm:10.2.2": - version: 10.2.2 - resolution: "supports-color@npm:10.2.2" - checksum: 10c0/fb28dd7e0cdf80afb3f2a41df5e068d60c8b4f97f7140de2eaed5b42e075d82a0e980b20a2c0efd2b6d73cfacb55555285d8cc719fa0472220715aefeaa1da7c - languageName: node - linkType: hard - "tar@npm:^7.5.4": version: 7.5.22 resolution: "tar@npm:7.5.22" @@ -1005,22 +884,6 @@ __metadata: languageName: node linkType: hard -"tree-kill@npm:1.2.2": - version: 1.2.2 - resolution: "tree-kill@npm:1.2.2" - bin: - tree-kill: cli.js - checksum: 10c0/7b1b7c7f17608a8f8d20a162e7957ac1ef6cd1636db1aba92f4e072dc31818c2ff0efac1e3d91064ede67ed5dc57c565420531a8134090a12ac10cf792ab14d2 - languageName: node - linkType: hard - -"tslib@npm:^2.1.0": - version: 2.8.1 - resolution: "tslib@npm:2.8.1" - checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62 - languageName: node - linkType: hard - "undici-types@npm:~5.26.4": version: 5.26.5 resolution: "undici-types@npm:5.26.5" @@ -1128,17 +991,6 @@ __metadata: languageName: node linkType: hard -"wrap-ansi@npm:^9.0.0": - version: 9.0.2 - resolution: "wrap-ansi@npm:9.0.2" - dependencies: - ansi-styles: "npm:^6.2.1" - string-width: "npm:^7.0.0" - strip-ansi: "npm:^7.1.0" - checksum: 10c0/3305839b9a0d6fb930cb63a52f34d3936013d8b0682ff3ec133c9826512620f213800ffa19ea22904876d5b7e9a3c1f40682f03597d986a4ca881fa7b033688c - languageName: node - linkType: hard - "ws@npm:^7.5.6": version: 7.5.9 resolution: "ws@npm:7.5.9" @@ -1175,37 +1027,9 @@ __metadata: languageName: node linkType: hard -"y18n@npm:^5.0.5": - version: 5.0.8 - resolution: "y18n@npm:5.0.8" - checksum: 10c0/4df2842c36e468590c3691c894bc9cdbac41f520566e76e24f59401ba7d8b4811eb1e34524d57e54bc6d864bcb66baab7ffd9ca42bf1eda596618f9162b91249 - languageName: node - linkType: hard - "yallist@npm:^5.0.0": version: 5.0.0 resolution: "yallist@npm:5.0.0" checksum: 10c0/a499c81ce6d4a1d260d4ea0f6d49ab4da09681e32c3f0472dee16667ed69d01dae63a3b81745a24bd78476ec4fcf856114cb4896ace738e01da34b2c42235416 languageName: node linkType: hard - -"yargs-parser@npm:^22.0.0": - version: 22.0.0 - resolution: "yargs-parser@npm:22.0.0" - checksum: 10c0/cb7ef81759c4271cb1d96b9351dbbc9a9ce35d3e1122d2b739bf6c432603824fa02c67cc12dcef6ea80283379d63495686e8f41cc7b06c6576e792aba4d33e1c - languageName: node - linkType: hard - -"yargs@npm:18.0.0": - version: 18.0.0 - resolution: "yargs@npm:18.0.0" - dependencies: - cliui: "npm:^9.0.1" - escalade: "npm:^3.1.1" - get-caller-file: "npm:^2.0.5" - string-width: "npm:^7.2.0" - y18n: "npm:^5.0.5" - yargs-parser: "npm:^22.0.0" - checksum: 10c0/bf290e4723876ea9c638c786a5c42ac28e03c9ca2325e1424bf43b94e5876456292d3ed905b853ebbba6daf43ed29e772ac2a6b3c5fb1b16533245d6211778f3 - languageName: node - linkType: hard