test github action
This commit is contained in:
parent
26f6b64be6
commit
3f96d2d1ed
15
.github/workflows/destversion.yml
vendored
Normal file
15
.github/workflows/destversion.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: Wechat Dest Version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- 0 16 * * *
|
||||
|
||||
jobs:
|
||||
save_new_wechat:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# - name: Config git
|
||||
# run: git config --global user.email "name@gmail.com"&&git config --global user.name "name"
|
||||
- name: Check new version and push
|
||||
run: bash -x ./scripts/destVersionRelease.sh
|
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
################################################################################
|
||||
# This below was automatically created for macOS system
|
||||
################################################################################
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
20
README.md
20
README.md
@ -1,2 +1,18 @@
|
||||
# wecaht-windows-versions
|
||||
保存微信历史版本
|
||||
# wechat-windows-versions
|
||||
收集 Windows 微信版本并保存
|
||||
|
||||
## 目录结构
|
||||
```shell
|
||||
├── README.md # 自述文件
|
||||
├── WeChatSetup # 微信安装包临时目录
|
||||
│ └── temp # 临时目录
|
||||
└── scripts # 脚本目录
|
||||
└── destVersionRelease.sh # 获取安装包及取得版本号与 hash 值的脚本
|
||||
```
|
||||
|
||||
## 说明
|
||||
项目使用 Github Action 自动下载微信最新版本安装包计算 Hash 值并推送至仓库。
|
||||
|
||||
**注意: 3.5.0.46 版本以下(不包含 3.5.0.46 版, 仅下载了一部分)均下载自 [web.archive.org](https://web.archive.org/web/*/https://pc.weixin.qq.com/)**
|
||||
|
||||
各版本更新日志可参见 [changelog](https://weixin.qq.com/cgi-bin/readtemplate?lang=zh_CN&t=weixin_faq_list&head=true)
|
99
scripts/destVersionRelease.sh
Executable file
99
scripts/destVersionRelease.sh
Executable file
@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
temp_path="WeChatSetup/temp"
|
||||
latest_path="WeChatSetup/latest"
|
||||
|
||||
download_link="$1"
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo -e "Missing argument. Using default download link"
|
||||
download_link="https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe"
|
||||
fi
|
||||
|
||||
function install_depends () {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mInstalling 7zip, shasum, wget, curl, git\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git
|
||||
}
|
||||
|
||||
function download_wechat() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mDownloading the newest WechatSetup...\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
wget "$download_link" -O ${temp_path}/WeChatSetup.exe
|
||||
if [ "$?" -ne 0 ]; then
|
||||
>&2 echo -e "\033[1;31mDownload Failed, please check your network!\033[0m"
|
||||
clean_data 1
|
||||
fi
|
||||
}
|
||||
|
||||
function extract_version() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mExtract WechatSetup, get the dest version of wechat\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
|
||||
local outfile=`7z l ${temp_path}/WeChatSetup.exe | grep improve.xml | awk 'NR ==1 { print $NF }'`
|
||||
## 7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp "\$R5/Tencent/WeChat/improve.xml"
|
||||
7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp $outfile
|
||||
dest_version=`awk '/MinVersion/{ print $2 }' ${temp_path}/temp/$outfile | sed -e 's/^.*="//g' -e 's/".*$//g'`
|
||||
}
|
||||
|
||||
|
||||
# rename and replace
|
||||
function prepare_commit() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mPrepare to commit new version\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
mkdir -p WeChatSetup/$dest_version
|
||||
cp $temp_path/WeChatSetup.exe WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe
|
||||
echo "DestVersion: $dest_version" > WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
|
||||
echo "Sha256: $now_sum256" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
|
||||
echo "UpdateTime: $(date -u '+%Y-%m-%d %H:%M:%S') (UTC)" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
|
||||
echo "DownloadFrom: $download_link" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
|
||||
|
||||
}
|
||||
|
||||
function clean_data() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mClean runtime and exit...\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
rm -rfv WeChatSetup/*
|
||||
exit $1
|
||||
}
|
||||
|
||||
function main() {
|
||||
rm -rfv WeChatSetup/*
|
||||
mkdir -p ${temp_path}/temp
|
||||
## https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
|
||||
# install_depends
|
||||
download_wechat
|
||||
|
||||
now_sum256=`shasum -a 256 ${temp_path}/WeChatSetup.exe | awk '{print $1}'`
|
||||
local latest_sum256=`gh release view --json body --jq ".body" | awk '/Sha256/{ print $2 }'`
|
||||
|
||||
if [ "$now_sum256" = "$latest_sum256" ]; then
|
||||
>&2 echo -e "\n\033[1;32mThis is the newest Version!\033[0m\n"
|
||||
clean_data 0
|
||||
fi
|
||||
## if not the newest
|
||||
extract_version
|
||||
prepare_commit
|
||||
|
||||
gh release create v$dest_version ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe -F ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256 -t "Wechat v$dest_version"
|
||||
clean_data 0
|
||||
}
|
||||
|
||||
main
|
||||
|
85
scripts/destversion.sh
Executable file
85
scripts/destversion.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
# 已废弃
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
temp_path="WeChatSetup/temp"
|
||||
latest_path="WeChatSetup/latest"
|
||||
|
||||
function install_depends () {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mInstalling 7zip, shasum, wget, curl, git\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git
|
||||
}
|
||||
|
||||
function download_wechat() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mDownloading the newest WechatSetup...\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
wget https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe -O ${temp_path}/WeChatSetup.exe
|
||||
if [ "$?" -ne 0 ]; then
|
||||
>&2 echo -e "\033[1;31mDownload Failed, please check your network!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function extract_version() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mExtract WechatSetup, get the dest version of wechat\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
mkdir -p ${temp_path}/temp
|
||||
local outfile=`7z l ${temp_path}/WeChatSetup.exe | grep improve.xml | awk 'NR ==1 { print $NF }'`
|
||||
# 7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp "\$R5/Tencent/WeChat/improve.xml"
|
||||
7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp $outfile
|
||||
dest_version=`awk '/MinVersion/{ print $2 }' ${temp_path}/temp/$outfile | sed -e 's/^.*="//g' -e 's/".*$//g'`
|
||||
rm -rfv ${temp_path}/temp
|
||||
}
|
||||
|
||||
|
||||
# rename and replace
|
||||
function prepare_commit() {
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
echo -e "## \033[1;33mPrepare to commit new version and clean runtime\033[0m"
|
||||
printf "#%.0s" {1..60}
|
||||
echo
|
||||
mkdir -p WeChatSetup/$dest_version
|
||||
cp $temp_path/WeChatSetup.exe WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe
|
||||
echo "$now_sum256 WeChatSetup-$dest_version.exe" > WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
|
||||
|
||||
cp $temp_path/WeChatSetup.exe WeChatSetup/latest/WeChatSetup-latest.exe
|
||||
echo "$now_sum256 WeChatSetup-latest.exe" > WeChatSetup/latest/WeChatSetup-latest.exe.sha256
|
||||
|
||||
# clean runtime
|
||||
rm -rfv ${temp_path}/*
|
||||
}
|
||||
|
||||
|
||||
function main() {
|
||||
install_depends
|
||||
download_wechat
|
||||
|
||||
now_sum256=`shasum -a 256 ${temp_path}/WeChatSetup.exe | awk '{print $1}'`
|
||||
local latest_sum256=`cat ${latest_path}/WeChatSetup-latest.exe.sha256 | awk '{print $1}'`
|
||||
|
||||
if [ "$now_sum256" = "$latest_sum256" ]; then
|
||||
>&2 echo -e "\n\033[1;32mThis is the newest Version! Clean runtime and exit...\033[0m\n"
|
||||
rm -rfv ${temp_path}/*
|
||||
exit 0
|
||||
fi
|
||||
## if not the newest
|
||||
extract_version
|
||||
prepare_commit
|
||||
|
||||
git add . && git commit -m "Add new dest version: $dest_version" && git push origin master
|
||||
}
|
||||
|
||||
main
|
||||
|
Loading…
Reference in New Issue
Block a user