mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
feat: aur 构建信息处理
This commit is contained in:
parent
a5bb4e44b9
commit
086aa5d045
@ -1 +1 @@
|
|||||||
1.05.2203030
|
1.05.2203030,63cb0e75df3704e155185d900258ac1e
|
@ -11,7 +11,7 @@ _wechat_devtools_ver="1.05.2203030"
|
|||||||
# https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203030&version_type=1
|
# https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203030&version_type=1
|
||||||
_wechat_devtools_url="https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=${_wechat_devtools_ver//\./}&version_type=1"
|
_wechat_devtools_url="https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=${_wechat_devtools_ver//\./}&version_type=1"
|
||||||
# _wechat_devtools_url="https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe"
|
# _wechat_devtools_url="https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe"
|
||||||
_wechat_devtools_md5="63cb0e75df3704e155185d900258ac1e"
|
_wechat_devtools_md5="123"
|
||||||
|
|
||||||
_wechat_devtools_exe="wechat_devtools_${_wechat_devtools_ver}_x64.exe"
|
_wechat_devtools_exe="wechat_devtools_${_wechat_devtools_ver}_x64.exe"
|
||||||
_nwjs_ver="0.53.1"
|
_nwjs_ver="0.53.1"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
notice() {
|
notice() {
|
||||||
echo -e "\033[36m $1 \033[0m "
|
echo -e "\033[36m $1 \033[0m "
|
||||||
}
|
}
|
||||||
@ -7,14 +7,14 @@ fail() {
|
|||||||
echo -e "\033[41;37m 失败 \033[0m $1"
|
echo -e "\033[41;37m 失败 \033[0m $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
tmp_dir="$root_dir/tmp"
|
tmp_dir="$root_dir/tmp"
|
||||||
build_dir="$root_dir/tmp/AUR"
|
build_dir="$root_dir/tmp/AUR"
|
||||||
|
|
||||||
# 没有预构建,获取不到
|
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||||
# DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" )
|
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||||
# DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
|
TARGET_VERSION=${VERSION_DATA[0]}
|
||||||
|
TARGET_VERSION_MD5=${VERSION_DATA[1]}
|
||||||
|
|
||||||
if [ -n "$1" ];then
|
if [ -n "$1" ];then
|
||||||
export BUILD_VERSION=$1
|
export BUILD_VERSION=$1
|
||||||
@ -25,13 +25,25 @@ fi
|
|||||||
echo "BUILD_VERSION: $BUILD_VERSION"
|
echo "BUILD_VERSION: $BUILD_VERSION"
|
||||||
# 及时构建修订版本号为0
|
# 及时构建修订版本号为0
|
||||||
if [ "$BUILD_VERSION" == "continuous" ];then
|
if [ "$BUILD_VERSION" == "continuous" ];then
|
||||||
# export BUILD_VERSION="v${DEVTOOLS_VERSION}-0"
|
|
||||||
pkgrel='0'
|
pkgrel='0'
|
||||||
else
|
else
|
||||||
# 提取BUILD_VERSION中的修订版本号
|
# 提取BUILD_VERSION中的修订版本号
|
||||||
pkgrel=$( echo $BUILD_VERSION | sed -r 's/v[0-9]+\.[0-9]+\.[0-9]+-(.*)/\1/' )
|
pkgrel=$( echo $BUILD_VERSION | sed -r 's/v[0-9]+\.[0-9]+\.[0-9]+-(.*)/\1/' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 非及时构建
|
||||||
|
if [ "$BUILD_VERSION" != "continuous" ];then
|
||||||
|
notice "检查版本号 -> $BUILD_VERSION"
|
||||||
|
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||||
|
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||||
|
DEVTOOLS_VERSION=${VERSION_DATA[0]}
|
||||||
|
INPUT_VERSION=$( echo $BUILD_VERSION | sed 's/v//' | sed 's/-.*//' )
|
||||||
|
if [[ "$INPUT_VERSION" != "$DEVTOOLS_VERSION" ]];then
|
||||||
|
fail "传入版本号与实际版本号不一致!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf $build_dir
|
rm -rf $build_dir
|
||||||
mkdir -p $build_dir
|
mkdir -p $build_dir
|
||||||
cp "$root_dir/tools"/*.sh "$build_dir"
|
cp "$root_dir/tools"/*.sh "$build_dir"
|
||||||
@ -39,16 +51,8 @@ cp "$root_dir/tools"/*.js "$build_dir"
|
|||||||
cp "$root_dir/res/aur"/* "$build_dir"
|
cp "$root_dir/res/aur"/* "$build_dir"
|
||||||
sed -i 's/download.fastgit.org/github.com/' "$build_dir/PKGBUILD"
|
sed -i 's/download.fastgit.org/github.com/' "$build_dir/PKGBUILD"
|
||||||
sed -i "s/pkgrel=[0-9]\+/pkgrel=${pkgrel}/" "$build_dir/PKGBUILD"
|
sed -i "s/pkgrel=[0-9]\+/pkgrel=${pkgrel}/" "$build_dir/PKGBUILD"
|
||||||
|
sed -i "s/_wechat_devtools_ver=\"[0-9]\+\.[0-9]\+\.[0-9]\+\"/_wechat_devtools_ver=\"${TARGET_VERSION}\"/" "$build_dir/PKGBUILD"
|
||||||
if [ "$BUILD_VERSION" != "continuous" ];then
|
sed -i "s/_wechat_devtools_md5=\".*\+\"/_wechat_devtools_md5=\"${TARGET_VERSION_MD5}\"/" "$build_dir/PKGBUILD"
|
||||||
notice "检查版本号 -> $BUILD_VERSION"
|
|
||||||
CONFIG_VERSION=$( cat "$build_dir/PKGBUILD" | grep -m 1 -Eo "[0-9]{1}\.[0-9]{2}\.[0-9]+" )
|
|
||||||
INPUT_VERSION=$( echo $BUILD_VERSION | sed 's/v//' | sed 's/-.*//' )
|
|
||||||
if [[ "$INPUT_VERSION" != "$CONFIG_VERSION" ]];then
|
|
||||||
fail "传入版本号与实际版本号不一致!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $build_dir
|
cd $build_dir
|
||||||
# makepkg
|
# makepkg
|
@ -68,7 +68,9 @@ if [[ $@ == *version* ]];then
|
|||||||
else
|
else
|
||||||
# 参数没有版本号,获取
|
# 参数没有版本号,获取
|
||||||
echo "参数没有版本号"
|
echo "参数没有版本号"
|
||||||
TARGET_VERSION="version="$( cat "$root_dir/conf/devtools_v")
|
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||||
|
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||||
|
TARGET_VERSION=${VERSION_DATA[0]}
|
||||||
fi
|
fi
|
||||||
echo "TARGET_VERSION: $TARGET_VERSION"
|
echo "TARGET_VERSION: $TARGET_VERSION"
|
||||||
if [ ! -f "$root_dir/package.nw/package.json" ];then
|
if [ ! -f "$root_dir/package.nw/package.json" ];then
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const { execSync, exec, spawn } = require("child_process");
|
const { execSync, spawn } = require("child_process");
|
||||||
const https = require("https");
|
const https = require("https");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
@ -36,6 +36,7 @@ const url = urls[branch];
|
|||||||
// https://dldir1.qq.com/WechatWebDev/nightly/p-7aa88fbb60d64e4a96fac38999591e31/wechat_devtools_1.02.2001202_x64.exe
|
// https://dldir1.qq.com/WechatWebDev/nightly/p-7aa88fbb60d64e4a96fac38999591e31/wechat_devtools_1.02.2001202_x64.exe
|
||||||
|
|
||||||
let version = args.version;
|
let version = args.version;
|
||||||
|
let md5;
|
||||||
|
|
||||||
const packageDir = "code/package.nw";
|
const packageDir = "code/package.nw";
|
||||||
|
|
||||||
@ -118,6 +119,8 @@ const download = function (url) {
|
|||||||
__dirname,
|
__dirname,
|
||||||
util.format("../cache/wechat_devtools_%s_x64.exe", version)
|
util.format("../cache/wechat_devtools_%s_x64.exe", version)
|
||||||
);
|
);
|
||||||
|
let headers = execSync(`curl -IL "${url}"`).toString()
|
||||||
|
md5 = headers.match(/X-COS-META-MD5: (.*?)\r/)[1]
|
||||||
|
|
||||||
if (fs.existsSync(localPath)) {
|
if (fs.existsSync(localPath)) {
|
||||||
resolve(localPath);
|
resolve(localPath);
|
||||||
@ -339,7 +342,7 @@ const start = async () => {
|
|||||||
// 写入版本
|
// 写入版本
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.resolve(__dirname, "../conf/devtools_v"),
|
path.resolve(__dirname, "../conf/devtools_v"),
|
||||||
version
|
`${version},${md5}`
|
||||||
)
|
)
|
||||||
console.log(
|
console.log(
|
||||||
`Succeeded upgrading wechat-devtools to version ${version}`
|
`Succeeded upgrading wechat-devtools to version ${version}`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user