Auto update v2 #2264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Description: Auto update package | |
# | |
name: "Auto update v2" | |
on: | |
push: | |
paths: | |
- '.github/workflows/Auto update v2.yml' | |
schedule: | |
- cron: "0 */4 * * *" | |
workflow_dispatch: | |
inputs: | |
packages: | |
description: 'packages' | |
required: false | |
default: 'false' | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
job_init: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: Initialization environment | |
run: | | |
sudo timedatectl set-timezone "$TZ" | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 1 | |
keep_minimum_runs: 0 | |
- name: SSH connection to Actions | |
uses: mxschmitt/action-tmate@master | |
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') | |
job_auto_update_main: | |
if: ${{ always() }} | |
needs: job_init | |
runs-on: ubuntu-latest | |
name: Auto-update-${{ matrix.pakcages }} | |
strategy: | |
fail-fast: false | |
matrix: | |
pakcages: [dns2tcp,ddns-go,dockerd,filebrowser,gost,mosdns,lua-neturl,lucky,redsocks2,smartdns,upx,UnblockNeteaseMusic,brook,hysteria,ipt2socks,microsocks,sing-box,shadowsocksr-libev,trojan,trojan-go,trojan-plus,v2ray-core,v2ray-plugin,xray-core,xray-plugin,v2ray-geoip,v2ray-geosite,v2ray-geoview] | |
include: | |
- pakcages: dns2tcp | |
folder: dns2tcp | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/zfl9/dns2tcp/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/zfl9/dns2tcp//tar.gz/v | |
file_name: | |
- pakcages: ddns-go | |
folder: ddns-go | |
version_line: 11 | |
hash_line: 16 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/jeessy2/ddns-go/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/jeessy2/ddns-go/tar.gz/v | |
file_name: | |
- pakcages: dockerd | |
folder: dockerd | |
version_line: 4 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/moby/moby/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/moby/moby/tar.gz/v | |
file_name: | |
- pakcages: filebrowser | |
folder: filebrowser | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/filebrowser/filebrowser/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/filebrowser/filebrowser/tar.gz/v | |
file_name: | |
- pakcages: gost | |
folder: gost | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/ginuerzh/gost/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/ginuerzh/gost/tar.gz/v | |
file_name: | |
- pakcages: mosdns | |
folder: mosdns | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/IrineSistiana/mosdns/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v | |
file_name: | |
- pakcages: lua-neturl | |
folder: lua-neturl | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/golgote/neturl/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/golgote/neturl/tar.gz/v | |
file_name: | |
- pakcages: lucky | |
folder: lucky | |
version_line: 11 | |
hash_line: 48 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/gdy666/lucky/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/gdy666/lucky/tar.gz/v | |
file_name: | |
- pakcages: redsocks2 | |
folder: redsocks2 | |
version_line: 9 | |
hash_line: 14 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/semigodking/redsocks/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'release-' '{print $2}' | |
release_download_url: https://codeload.github.com/semigodking/redsocks/tar.gz/release- | |
file_name: | |
- pakcages: smartdns | |
folder: smartdns | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/pymumu/smartdns/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'Release' '{print $2}' | |
release_download_url: https://codeload.github.com/pymumu/smartdns/tar.gz/Release | |
file_name: | |
- pakcages: upx | |
folder: upx | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/upx/upx/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://github.com/upx/upx/releases/download/v | |
file_name: /upx-$New_PKG_VERSION-src.tar.xz | |
- pakcages: UnblockNeteaseMusic | |
folder: UnblockNeteaseMusic | |
version_line: 4 | |
hash_line: 9 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/UnblockNeteaseMusic/server/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/UnblockNeteaseMusic/server/tar.gz/v | |
file_name: | |
- pakcages: brook | |
folder: brook | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/txthinking/brook/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/txthinking/brook/tar.gz/v | |
file_name: | |
- pakcages: hysteria | |
folder: hysteria | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/apernet/hysteria/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/apernet/hysteria/tar.gz/app/v | |
file_name: | |
- pakcages: ipt2socks | |
folder: ipt2socks | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/zfl9/ipt2socks/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/zfl9/ipt2socks/tar.gz/v | |
file_name: | |
- pakcages: microsocks | |
folder: microsocks | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/rofl0r/microsocks/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/rofl0r/microsocks/tar.gz/v | |
file_name: | |
- pakcages: sing-box | |
folder: sing-box | |
version_line: 9 | |
hash_line: 14 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/SagerNet/sing-box/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/SagerNet/sing-box/tar.gz/v | |
file_name: | |
- pakcages: shadowsocksr-libev | |
folder: shadowsocksr-libev | |
version_line: 4 | |
hash_line: 9 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/shadowsocksrr/shadowsocksr-libev/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/shadowsocksrr/shadowsocksr-libev/tar.gz/v | |
file_name: | |
- pakcages: trojan | |
folder: trojan | |
version_line: 10 | |
hash_line: 15 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/trojan-gfw/trojan/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/trojan-gfw/trojan/tar.gz/v | |
file_name: | |
- pakcages: trojan-go | |
folder: trojan-go | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/p4gefau1t/trojan-go/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/p4gefau1t/trojan-go/tar.gz/v | |
file_name: | |
- pakcages: trojan-plus | |
folder: trojan-plus | |
version_line: 4 | |
hash_line: 9 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/peter-tank/trojan-plus/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/peter-tank/trojan-plus/tar.gz/v | |
file_name: | |
- pakcages: v2ray-core | |
folder: v2ray-core | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/v2fly/v2ray-core/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/v2fly/v2ray-core/tar.gz/v | |
file_name: | |
- pakcages: v2ray-plugin | |
folder: v2ray-plugin | |
version_line: 9 | |
hash_line: 14 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/teddysun/v2ray-plugin/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/teddysun/v2ray-plugin/tar.gz/v | |
file_name: | |
- pakcages: xray-core | |
folder: xray-core | |
version_line: 4 | |
hash_line: 9 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/XTLS/Xray-core/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/XTLS/Xray-core/tar.gz/v | |
file_name: | |
- pakcages: xray-plugin | |
folder: xray-plugin | |
version_line: 8 | |
hash_line: 13 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/teddysun/xray-plugin/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/teddysun/xray-plugin/tar.gz/v | |
file_name: | |
- pakcages: v2ray-geoip | |
folder: v2ray-geodata | |
version_line: 15 | |
hash_line: 21 | |
version_head: GEOIP_VER:= | |
hash_head: \ HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/v2fly/geoip/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | |
release_download_url: https://github.com/v2fly/geoip/releases/download/ | |
file_name: /geoip.dat | |
- pakcages: v2ray-geosite | |
folder: v2ray-geodata | |
version_line: 24 | |
hash_line: 30 | |
version_head: GEOSITE_VER:= | |
hash_head: \ HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/v2fly/domain-list-community/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | |
release_download_url: https://github.com/v2fly/domain-list-community/releases/download/ | |
file_name: /dlc.dat | |
- pakcages: v2ray-geosite-ir | |
folder: v2ray-geodata | |
version_line: 33 | |
hash_line: 39 | |
version_head: GEOSITE_IRAN_VER:= | |
hash_head: \ HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/bootmortis/iran-hosted-domains/releases" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | |
release_download_url: https://github.com/bootmortis/iran-hosted-domains/releases/download/ | |
file_name: /iran.dat | |
- pakcages: v2ray-geoview | |
folder: v2ray-geoview | |
version_line: 4 | |
hash_line: 9 | |
version_head: PKG_VERSION:= | |
hash_head: PKG_HASH:= | |
release_api_command: curl -sL "https://api.github.com/repos/snowie2000/geoview/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g' | awk -F 'v' '{print $2}' | |
release_download_url: https://codeload.github.com/snowie2000/geoview/tar.gz/ | |
file_name: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: Initialization environment | |
run: | | |
cd && mkdir -p main && cd main | |
sudo timedatectl set-timezone "$TZ" | |
- name: Check ${{ matrix.pakcages }} | |
id: check | |
run: | | |
is_continue=true | |
if [ "$is_continue" = "true" ]; then | |
cd && cd work/wall/wall/${{ matrix.folder }} | |
Old_PKG_VERSION=$(sed -n '${{ matrix.version_line }}p' Makefile | awk -F '=' '{print $2}') | |
New_PKG_VERSION=$(${{ matrix.release_api_command }}) | |
echo "${{ matrix.pakcages }}目前版本: $Old_PKG_VERSION" | |
echo "${{ matrix.pakcages }}最新版本: $New_PKG_VERSION" | |
if [ "$Old_PKG_VERSION" = "$New_PKG_VERSION" ]; then | |
echo "status=failure" >> $GITHUB_OUTPUT; | |
echo "${{ matrix.pakcages }}版本为最新版本$New_PKG_VERSION,无需更新"; | |
else | |
echo "New_PKG_VERSION=$New_PKG_VERSION" >> $GITHUB_OUTPUT; | |
echo "status=success" >> $GITHUB_OUTPUT; | |
fi | |
else | |
echo "status=failure" >> $GITHUB_OUTPUT; | |
fi | |
- name: Update ${{ matrix.pakcages }} | |
id: update | |
if: steps.check.outputs.status == 'success' && steps.check.outputs.New_PKG_VERSION != '' && !cancelled() | |
run: | | |
cd && cd work/wall/wall/${{ matrix.folder }} | |
New_PKG_VERSION=${{ steps.check.outputs.New_PKG_VERSION }} | |
sed -i "${{ matrix.version_line }}c ${{ matrix.version_head }}$New_PKG_VERSION" Makefile | |
cd && cd main && mkdir -p ${{ matrix.pakcages }} && cd ${{ matrix.pakcages }} | |
wget -P / ${{ matrix.release_download_url }}$New_PKG_VERSION${{ matrix.file_name }} | |
file_name=${{ matrix.file_name }} | |
is_v=$(echo ${{ matrix.release_download_url }} | awk -F/ '{print $NF}') | |
if [ ! -n "${{ matrix.file_name }}" ]; then PKG_HASH=$(sha256sum $is_v$New_PKG_VERSION) && PKG_HASH=${PKG_HASH%% *}; else PKG_HASH=$(sha256sum ${file_name##*/}) && PKG_HASH=${PKG_HASH%% *}; fi; | |
cd && cd work/wall/wall/${{ matrix.folder }} | |
sed -i "${{ matrix.hash_line }}c ${{ matrix.hash_head }}$PKG_HASH" Makefile | |
echo "已更新${{ matrix.pakcages }}版本到: $New_PKG_VERSION" | |
echo "${{ matrix.pakcages }} Hash:$PKG_HASH" | |
cd && cd main | |
echo ":white_check_mark: ${{ matrix.pakcages }}: update to $New_PKG_VERSION" >> commit_messages.txt | |
echo "version=$New_PKG_VERSION" >> $GITHUB_OUTPUT | |
cd && cd work/wall/wall | |
echo "branch_exists=$(git ls-remote --heads origin ${{ matrix.pakcages }}-$New_PKG_VERSION | tr -d '\n')" >> $GITHUB_OUTPUT | |
- name: Git Auto Commit | |
uses: stefanzweifel/git-auto-commit-action@master | |
id: commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
commit_user_name: "action" | |
commit_user_email: "[email protected]" | |
commit_author: "kenzok8 <[email protected]>" | |
commit_message: "${{ matrix.pakcages }}: update to ${{ steps.update.outputs.version }}" | |
branch: main |