diff --git a/.github/workflows/发布wordpress文章.yml b/.github/workflows/发布wordpress文章.yml index 7b9e29b..381e86e 100644 --- a/.github/workflows/发布wordpress文章.yml +++ b/.github/workflows/发布wordpress文章.yml @@ -17,13 +17,14 @@ jobs: TZ: Asia/Shanghai run: date - # 1. 读取 README.md 内容并清理特殊字符 + # 1. 读取 README.md 内容 - name: 读取 README.md 内容 id: read_wp run: | - CONTENT=$(sed ':a;N;$!ba;s/\n/\\n/g' README.md) # 将换行符替换为 \n + CONTENT=$(> $GITHUB_ENV - echo "$CONTENT" >> $GITHUB_ENV + echo "$CONTENT" | jq -Rs . >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV # 2. 读取固件版本 DISTRIB_REVISION.txt @@ -48,30 +49,28 @@ jobs: POST_STATUS: "draft" run: | FORMATTED_TIME=$(TZ='Asia/Shanghai' date "+%Y年%m月%d日") - JSON_PAYLOAD=$(jq -n \ - --arg content "${{ env.wp_content }}" \ - --arg title "${FORMATTED_TIME}最新每天更新OpenWRT&LEDE x86/64 软路由精品稳定版固件下载含插件" \ - --arg post_status "$POST_STATUS" \ - --arg firmware_version "${{ env.firmware_version }}" \ - --arg kernel_version "6.X" \ - --arg file_size "1024MB" \ - --arg update_time "$FORMATTED_TIME" \ - '{ - title: $title, - description: $content, - post_status: $post_status, - custom_fields: [ - {key: "wb_dl_firmware_version", value: $firmware_version}, - {key: "wb_dl_kernel_version", value: $kernel_version}, - {key: "wb_dl_file_size", value: $file_size}, - {key: "wb_dl_update_time", value: $update_time} - ] - }' + + # 创建 JSON 数据内容,保持 README 内容的原始格式 + JSON_PAYLOAD=$(cat <