Skip to content

Commit

Permalink
CI: follow daily_release
Browse files Browse the repository at this point in the history
  • Loading branch information
northsea4 committed May 29, 2024
1 parent 35b1839 commit 1fdb9b5
Show file tree
Hide file tree
Showing 9 changed files with 944 additions and 497 deletions.
14 changes: 7 additions & 7 deletions .env.versions
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 本项目版本
PROJECT_VERSION=0.7.3
PROJECT_VERSION=0.8.0

#=== start === gui-base images ==========================

# `stainless403/gui-base`镜像版本
GUI_BASE_VERSION=0.4.0

# `stainless403/mdcx-builtin-gui-base`镜像版本
GUI_BASE_MDCX_BUILTIN_VERSION=120240220
GUI_BASE_MDCX_BUILTIN_VERSION=d20240527

# `stainless403/mdcx-src-gui-base`镜像版本
GUI_BASE_MDCX_SRC_VERSION=0.2.1
GUI_BASE_MDCX_SRC_VERSION=0.3.0

#=== end === gui-base images ==========================

Expand All @@ -21,10 +21,10 @@ GUI_BASE_MDCX_SRC_VERSION=0.2.1
WEBTOP_BASE_VERSION=0.1.2

# `stainless403/mdcx-builtin-webtop-base`镜像版本
WEBTOP_BASE_MDCX_BUILTIN_VERSION=120240220
WEBTOP_BASE_MDCX_BUILTIN_VERSION=d20240527

# `stainless403/mdcx-src-webtop-base`镜像版本
WEBTOP_BASE_MDCX_SRC_VERSION=0.2.1
WEBTOP_BASE_MDCX_SRC_VERSION=0.3.0

#=== end === webtop-base images ==========================

Expand All @@ -35,10 +35,10 @@ WEBTOP_BASE_MDCX_SRC_VERSION=0.2.1
BUILD_MDCX_BASE_VERSION=0.4.0

# `stainless403/build-mdcx`镜像版本
BUILD_MDCX_VERSION=120240220
BUILD_MDCX_VERSION=d20240527

#=== end === build-mdcx images ==========================


# MDCx最新版本
MDCX_APP_VERSION=120240220
MDCX_APP_VERSION=d20240527
59 changes: 21 additions & 38 deletions .github/workflows/watch-mdcx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,59 +58,42 @@ jobs:
run: |
source scripts/base.sh
source scripts/github.sh
source scripts/release-utils.sh
VAR_VERSION="MDCX_LATEST_VERSION"
VAR_TIME="MDCX_LATEST_TIME"
# 获取最新版本信息,返回值为数组,第一个元素为版本号,第二个元素为更新时间
getNewInfo() {
local _content=$(curl -s "${{ env.RELEASE_URL }}")
# tag名称,作为版本号
local tagName=$(printf '%s' $_content | jq -r ".tag_name")
local archiveVersion=$(echo $tagName | sed 's/v//g')
if [[ -z "$archiveVersion" || "$archiveVersion" == "null" ]]; then
echo "❌ 获取版本号失败!"
return 1
fi
# 源码压缩包(tar格式)链接
local archiveUrl=$(printf '%s' $_content | jq -r ".tarball_url")
REPO="sqzw-x/mdcx"
TAG_NAME="daily_release"
if [[ -z "$archiveUrl" ]]; then
echo "❌ 从请求结果获取源码压缩包文件下载链接失败!"
echo "🔘 请求链接:$_url"
echo "🔘 请求结果:$_content"
exit 1
fi
REPO="sqzw-x/mdcx"
TAG_NAME="daily_release"
# https://gitbook.curiouser.top/origin/linux-jq.html#%E4%B8%89%E3%80%81jq%E5%91%BD%E4%BB%A4%E5%8F%82%E6%95%B0
# -r 如果过滤的结果是一个字符串,那么直接写到标准输出(去掉字符串的引号);
local updatedAt=$(printf '%s' $_content | jq -r '.updated_at')
# 如果没有`updated_at`,则取`published_at`
if [[ -z "$updatedAt" || "$updatedAt" == "null" ]]; then
updatedAt=$(printf '%s' $_content | jq -r '.published_at')
fi
info=$(get_release_info "$REPO" "$TAG_NAME")
if [[ $? -ne 0 ]]; then
echo "❌ 获取仓库 ${REPO} 中 tag_name=${TAG_NAME} 的release信息失败!"
exit 1
else
echo "✅ 获取仓库 ${REPO} 中 tag_name=${TAG_NAME} 的release信息成功!"
fi
echo $info | jq
if [[ -z "$updatedAt" || "$updatedAt" == "null" ]]; then
echo "❌ 获取更新时间失败!"
return 1
fi
# 发布时间
published_at=$(printf '%s' $info | jq -r ".published_at")
echo "📅 发布时间: $published_at"
local info=("$archiveVersion" "$updatedAt")
echo "${info[@]}"
return 0
}
# 版本号
release_version=$(printf '%s' $info | jq -r ".release_version")
echo "🔢 版本号: $release_version"
newVersion=""
newTime=""
hasNewVersion=false
# 获取最新版本信息
info=($(getNewInfo))
newVersion=${info[0]}
newTime=${info[1]}
newVersion="$release_version"
newTime="$published_at"
# 获取已记录的版本信息
latestVersion=$(getVariable $VAR_VERSION)
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,9 @@ docker run -d --name mdcx \


## FAQ
请查看 [FAQ](https://github.com/northsea4/mdcx-docker/blob/main/FAQ.md)
请查看 [FAQ](https://github.com/northsea4/mdcx-docker/blob/main/FAQ.md)


## TODO
- [x] 上游源码采用了daily release自动发布,看能不能跟随
- [ ] 一键脚本github镜像加速
Loading

0 comments on commit 1fdb9b5

Please sign in to comment.