fix: artifact 传递补两个坑(隐藏文件 + 产物层数)
Deploy to Production / probe-network (push) Skipped
Deploy to Production / pre-check (push) Successful in 54s
Deploy to Production / build (push) Failing after 3m53s
Deploy to Production / deploy-edgeone (push) Skipped
Deploy to Production / finalize (push) Skipped
Deploy to Production / notify-failure (push) Successful in 4s
Deploy to Production / probe-network (push) Skipped
Deploy to Production / pre-check (push) Successful in 54s
Deploy to Production / build (push) Failing after 3m53s
Deploy to Production / deploy-edgeone (push) Skipped
Deploy to Production / finalize (push) Skipped
Deploy to Production / notify-failure (push) Successful in 4s
- upload-artifact@v4 默认排除隐藏文件,public/.build_hash 会丢 → 开 include-hidden-files: true,否则中转机读不到 hash 无法判断同步 - download 后产物可能多一层 public/ → EdgeOne 部署前统一拍平并校验 index.html 配合中转机 sync.sh 改造(COS → Gitea artifact),两者需同时生效。
This commit is contained in:
1 parent
4ede54b96d
commit
fffdbe6865
1 file changed
+24
@@ -224,10 +224,15 @@ jobs:
|
|||||||
# - deploy-edgeone 用 actions/download-artifact 直接拿(同 runner,零跨境)
|
# - deploy-edgeone 用 actions/download-artifact 直接拿(同 runner,零跨境)
|
||||||
# - 国内中转机用 Gitea API 下载 artifact zip(替代原先的「从 COS 下载」)
|
# - 国内中转机用 Gitea API 下载 artifact zip(替代原先的「从 COS 下载」)
|
||||||
# hash 写在 public/.build_hash 里随 artifact 一起走,中转机解压后读它判断是否同步。
|
# hash 写在 public/.build_hash 里随 artifact 一起走,中转机解压后读它判断是否同步。
|
||||||
|
#
|
||||||
|
# ★ include-hidden-files 必须为 true:
|
||||||
|
# upload-artifact@v4 默认「忽略隐藏文件」(以 . 开头),.build_hash 正好是隐藏
|
||||||
|
# 文件,不开这个开关它不会进 artifact,中转机就读不到 hash、无法判断是否需要同步。
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: hugo-public
|
name: hugo-public
|
||||||
path: public/
|
path: public/
|
||||||
|
include-hidden-files: true
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Report deploy status (built)
|
- name: Report deploy status (built)
|
||||||
@@ -423,6 +428,25 @@ jobs:
|
|||||||
name: hugo-public
|
name: hugo-public
|
||||||
path: public/
|
path: public/
|
||||||
|
|
||||||
|
- name: Normalize artifact layout
|
||||||
|
# upload-artifact 对「目录路径」的打包语义存在版本/实现差异:
|
||||||
|
# 解出来的可能是 public/index.html(内容直接在根),也可能是
|
||||||
|
# public/public/index.html(多一层目录)。这里统一拍平成 public/index.html,
|
||||||
|
# 免得 EdgeOne 部署时找不到入口、或站点多出一层 /public/ 前缀。
|
||||||
|
run: |
|
||||||
|
if [ ! -f public/index.html ] && [ -f public/public/index.html ]; then
|
||||||
|
echo "ℹ️ 检测到产物多一层 public/,已拍平"
|
||||||
|
mv public/public public__flat
|
||||||
|
rm -rf public
|
||||||
|
mv public__flat public
|
||||||
|
fi
|
||||||
|
if [ ! -f public/index.html ]; then
|
||||||
|
echo "❌ 产物结构异常:public/index.html 不存在"
|
||||||
|
find public -maxdepth 2 | head -20
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ public/index.html 就位,文件数 $(find public -type f | wc -l)"
|
||||||
|
|
||||||
- name: Start upload timing
|
- name: Start upload timing
|
||||||
id: start-edgeone-upload
|
id: start-edgeone-upload
|
||||||
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in new issue
Block a user