This commit is contained in:
parent
31212b0ffa
commit
6b78b01d1a
35
.github/workflows/发布wordpress文章.yml
vendored
35
.github/workflows/发布wordpress文章.yml
vendored
@ -9,15 +9,13 @@ jobs:
|
||||
generate_changelog:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# 检出代码
|
||||
- name: 🛒 检出代码
|
||||
uses: https://git.aoun.ltd/actions/checkout@v4
|
||||
|
||||
# 设置时区
|
||||
- name: 设置时区
|
||||
env:
|
||||
TZ: Asia/Shanghai
|
||||
run: date # 验证时区设置是否生效
|
||||
run: date
|
||||
|
||||
# 1. 读取 README.md 内容
|
||||
- name: 读取 README.md 内容
|
||||
@ -46,22 +44,23 @@ jobs:
|
||||
WORDPRESS_URL: ${{ secrets.WORDPRESS_URL }}
|
||||
WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }}
|
||||
WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }}
|
||||
POST_ID: 829 # 替换为文章ID
|
||||
POST_STATUS: "draft" # 设置文章状态为 'publish' (可以更改为 'draft' 或 'pending')
|
||||
POST_ID: 829
|
||||
POST_STATUS: "draft"
|
||||
run: |
|
||||
# 获取当前中国时间
|
||||
FORMATTED_TIME=$(TZ='Asia/Shanghai' date "+%Y年%m月%d日")
|
||||
|
||||
# 定义更新的数据内容
|
||||
JSON_PAYLOAD=$(jq -n \
|
||||
--arg content "$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_PAYLOAD=$(cat <<EOF
|
||||
{
|
||||
"title": "${FORMATTED_TIME}最新每天更新OpenWRT&LEDE x86/64 软路由精品稳定版固件下载含插件",
|
||||
"description": "${{ env.wp_content }}",
|
||||
"post_status": "$POST_STATUS",
|
||||
"custom_fields": [
|
||||
{"key": "wb_dl_firmware_version", "value": "${{ env.firmware_version }}"},
|
||||
{"key": "wb_dl_kernel_version", "value": "6.X"},
|
||||
{"key": "wb_dl_file_size", "value": "1024MB"},
|
||||
{"key": "wb_dl_update_time", "value": "$FORMATTED_TIME"}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
# 更新 WordPress 文章
|
||||
@ -71,4 +70,4 @@ jobs:
|
||||
--data "$JSON_PAYLOAD")
|
||||
|
||||
# 检查响应状态
|
||||
echo "$RESPONSE" | jq . || echo "更新失败"
|
||||
echo "$RESPONSE" | jq . || echo "更新失败"
|
||||
|
Loading…
Reference in New Issue
Block a user