This commit is contained in:
parent
3477a474c4
commit
39f45b9e58
17
.github/workflows/发布wordpress文章.yml
vendored
17
.github/workflows/发布wordpress文章.yml
vendored
@ -17,16 +17,7 @@ jobs:
|
||||
TZ: Asia/Shanghai
|
||||
run: date
|
||||
|
||||
# 1. 读取 README.md 内容
|
||||
- name: 读取 README.md 内容
|
||||
id: read_wp
|
||||
run: |
|
||||
CONTENT=$(<README.md)
|
||||
# JSON 转义并保存到环境变量
|
||||
wp_content=$(echo "$CONTENT" | jq -Rs .)
|
||||
echo "wp_content=$wp_content" >> $GITHUB_ENV
|
||||
|
||||
# 2. 读取固件版本 DISTRIB_REVISION.txt
|
||||
# 1. 读取固件版本 DISTRIB_REVISION.txt
|
||||
- name: 读取 DISTRIB_REVISION.txt 中的固件版本
|
||||
id: read_firmware
|
||||
run: |
|
||||
@ -38,7 +29,7 @@ jobs:
|
||||
echo "firmware_version=Unknown" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
# 3. 更新 WordPress 文章
|
||||
# 2. 更新 WordPress 文章
|
||||
- name: 更新 WordPress 文章
|
||||
env:
|
||||
WORDPRESS_URL: ${{ secrets.WORDPRESS_URL }}
|
||||
@ -46,7 +37,6 @@ jobs:
|
||||
WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }}
|
||||
POST_ID: 829
|
||||
POST_STATUS: "draft"
|
||||
wp_content: ${{ env.wp_content }}
|
||||
firmware_version: ${{ env.firmware_version }}
|
||||
run: |
|
||||
FORMATTED_TIME=$(TZ='Asia/Shanghai' date "+%Y年%m月%d日")
|
||||
@ -54,10 +44,10 @@ jobs:
|
||||
# 创建 JSON 数据内容,保持 README 内容的原始格式
|
||||
JSON_PAYLOAD=$(jq -n \
|
||||
--arg title "${FORMATTED_TIME}最新每天更新OpenWRT&LEDE x86/64 软路由精品稳定版固件下载含插件" \
|
||||
--argjson description "$wp_content" \
|
||||
--arg post_status "$POST_STATUS" \
|
||||
--arg firmware_version "$firmware_version" \
|
||||
--arg formatted_time "$FORMATTED_TIME" \
|
||||
--rawfile description README.md \
|
||||
'{
|
||||
title: $title,
|
||||
description: $description,
|
||||
@ -79,4 +69,3 @@ jobs:
|
||||
|
||||
# 检查响应状态
|
||||
echo "$RESPONSE" | jq . || echo "更新失败"
|
||||
|
Loading…
Reference in New Issue
Block a user