1028
Some checks failed
获取完整内核版本 / clone_with_proxy (push) Failing after 1m28s

This commit is contained in:
298977887 2024-10-28 16:45:12 +08:00
parent dab41e864d
commit 71635ec5b9
2 changed files with 24 additions and 11 deletions

View File

@ -123,23 +123,35 @@ jobs:
env:
OPENWRT_VERSION: "${{ env.FULL_KERNEL_VERSION }}"
run: |
# 定义需要替换的变量
LATEST_VERSION="R$(date +'%y.%m.%d')-$(date +'%H%M')"
# 定义变量
LATEST_VERSION="R$(date +'%y.%m.%d_%H%M')"
ARCHITECTURE="x86_64"
FILE_SIZE="1024MB" # 可以根据实际情况动态获取
RELEASE_DATE="$(date +'%Y-%m-%d')"
FILE_SIZE="1024MB"
RELEASE_DATE="$(date +'%Y.%m.%d')"
BUILD_STATUS="成功"
FIRMWARE_TYPE="稳定版"
OPENWRT_VERSION="${OPENWRT_VERSION}"
# URL 编码函数
url_encode() {
local data
data=$(echo -n "$1" | od -An -tx1 | tr ' ' % | tr -d '\n')
echo "$data"
}
# 对变量进行 URL 编码
LATEST_VERSION_ENCODED=$(url_encode "$LATEST_VERSION")
RELEASE_DATE_ENCODED=$(url_encode "$RELEASE_DATE")
OPENWRT_VERSION_ENCODED=$(url_encode "$OPENWRT_VERSION")
# 更新 README.md 文件中的内容
sed -i "s/最新版本-[^\-]*/最新版本-${LATEST_VERSION}/" README.md
sed -i "s/适用架构-[^\-]*/适用架构-${ARCHITECTURE}/" README.md
sed -i "s/文件大小-[^\-]*/文件大小-${FILE_SIZE}/" README.md
sed -i "s/发布日期-[^\-]*/发布日期-${RELEASE_DATE}/" README.md
sed -i "s/构建状态-[^\-]*/构建状态-${BUILD_STATUS}/" README.md
sed -i "s/固件类型-[^\-]*/固件类型-${FIRMWARE_TYPE}/" README.md
sed -i "s/OpenWrt版本-[^\-]*/OpenWrt版本-${OPENWRT_VERSION}/" README.md
sed -i "s/{{LATEST_VERSION}}/${LATEST_VERSION_ENCODED}/g" README.md
sed -i "s/{{ARCHITECTURE}}/${ARCHITECTURE}/g" README.md
sed -i "s/{{FILE_SIZE}}/${FILE_SIZE}/g" README.md
sed -i "s/{{RELEASE_DATE}}/${RELEASE_DATE_ENCODED}/g" README.md
sed -i "s/{{BUILD_STATUS}}/${BUILD_STATUS}/g" README.md
sed -i "s/{{FIRMWARE_TYPE}}/${FIRMWARE_TYPE}/g" README.md
sed -i "s/{{OPENWRT_VERSION}}/${OPENWRT_VERSION_ENCODED}/g" README.md
# 显示更新后的 README.md 内容
cat README.md

View File

@ -9,3 +9,4 @@
![Build Status](https://img.shields.io/badge/构建状态-成功-brightgreen)
![Firmware Type](https://img.shields.io/badge/固件类型-稳定版-brightgreen)
![Based on OpenWrt](https://img.shields.io/badge/OpenWrt版本-22.03.3-00bfff)