name: 发布wordpress文章 on: push: branches: - main jobs: generate_changelog: runs-on: ubuntu-latest steps: - name: 🛒 检出代码 uses: https://git.aoun.ltd/actions/checkout@v4 - name: 设置时区 env: TZ: Asia/Shanghai run: date # 1. 读取 README.md 内容 - name: 读取 README.md 内容 id: read_wp run: | CONTENT=$(> $GITHUB_ENV echo "$CONTENT" | jq -Rs . >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV # 2. 读取固件版本 DISTRIB_REVISION.txt - name: 读取 DISTRIB_REVISION.txt 中的固件版本 id: read_firmware run: | if [ -f DISTRIB_REVISION.txt ]; then FIRMWARE_VERSION=$(sed -n '2p' DISTRIB_REVISION.txt | xargs) echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_ENV else echo "固件版本文件不存在,设置默认值" >&2 echo "firmware_version=Unknown" >> $GITHUB_ENV fi # 3. 更新 WordPress 文章 - name: 更新 WordPress 文章 env: WORDPRESS_URL: ${{ secrets.WORDPRESS_URL }} WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }} WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }} POST_ID: 829 POST_STATUS: "draft" run: | FORMATTED_TIME=$(TZ='Asia/Shanghai' date "+%Y年%m月%d日") # 创建 JSON 数据内容,保持 README 内容的原始格式 JSON_PAYLOAD=$(cat <