forked from wukongdaily/RunFilesBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (200 loc) · 9.74 KB
/
ssrp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#=================================================
# https://github.com/wukongdaily/RunFilesBuilder
# Description: Build RunFiles using GitHub Actions
# Lisence: MIT
# Author: wukongdaily
# Blog: wkdaily.cpolar.top
#=================================================
name: Make ShadowsocksPlus+ run files
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
package_version:
description: '这里是包版本'
required: false
default: 'packages-24.10'
jobs:
build:
if: ${{ github.repository == 'wukongdaily/RunFilesBuilder' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Clone makeself repo
run: |
git clone https://github.com/megastep/makeself.git
- name: Create directories for x86_64 and a53 and set PACKAGE_VERSION
run: |
mkdir -p x86_64/depends a53/depends
package_version="${{ github.event.inputs.package_version }}"
if [ -z "$package_version" ]; then
package_version="packages-24.10"
fi
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV
- name: Download ipk files for x86_64 and a53
run: |
echo "Get PACKAGE_VERSION=$PACKAGE_VERSION"
FILE_PREFIXES=("dns2tcp" "lua-neturl" "chinadns-ng" "dns2socks" "hysteria" "ipt2socks" "microsocks" "mosdns" "naiveproxy" "redsocks2" "shadowsocksr-libev" "shadowsocks-rust" "shadow-tls" "simple-obfs-client" "tcping" "trojan" "tuic-client" "v2ray-plugin" "xray-core" "luci-app-ssr-plus")
EXCLUDE_PREFIXES=("luci-app-chinadns-ng" "luci-app-microsocks" "luci-app-mosdns" "luci-app-naiveproxy" "luci-app-redsocks2" "luci-app-shadowsocks")
BASE_URL_X86="https://dl.openwrt.ai/$PACKAGE_VERSION/x86_64/kiddin9/"
echo "Fetching x86 directory page from $BASE_URL_X86"
wget -qO- "$BASE_URL_X86" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
exclude_file=false
for exclude_prefix in "${EXCLUDE_PREFIXES[@]}"; do
if [[ "$FILE" == $exclude_prefix* ]]; then
exclude_file=true
break
fi
done
if $exclude_file; then
echo "Skip file: $FILE"
continue
fi
FILE_URL="${BASE_URL_X86}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "x86_64/depends/$(basename $FILE_URL)" -#
fi
done
done
BASE_URL_A53="https://dl.openwrt.ai/$PACKAGE_VERSION/aarch64_cortex-a53/kiddin9/"
echo "Fetching a53 directory page from $BASE_URL_A53"
wget -qO- "$BASE_URL_A53" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
exclude_file=false
for exclude_prefix in "${EXCLUDE_PREFIXES[@]}"; do
if [[ "$FILE" == $exclude_prefix* ]]; then
exclude_file=true
break
fi
done
if $exclude_file; then
echo "Skip file: $FILE"
continue
fi
FILE_URL="${BASE_URL_A53}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "a53/depends/$(basename $FILE_URL)" -#
fi
done
done
- name: downloads libopenssl3 & libudns ipk
run: |
echo "downloading libopenssl3 ipk"
FILE_PREFIXES=("libopenssl3" "libudns")
BASE_URL_X86="https://dl.openwrt.ai/$PACKAGE_VERSION/x86_64/base/"
wget -qO- "$BASE_URL_X86" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
FILE_URL="${BASE_URL_X86}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "x86_64/depends/$(basename $FILE_URL)" -#
fi
done
done
BASE_URL_A53="https://dl.openwrt.ai/$PACKAGE_VERSION/aarch64_cortex-a53/base/"
wget -qO- "$BASE_URL_A53" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
FILE_URL="${BASE_URL_A53}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "a53/depends/$(basename $FILE_URL)" -#
fi
done
done
echo "downloading libudns ipk"
BASE_URL_X86="https://dl.openwrt.ai/$PACKAGE_VERSION/x86_64/packages/"
wget -qO- "$BASE_URL_X86" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
FILE_URL="${BASE_URL_X86}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "x86_64/depends/$(basename $FILE_URL)" -#
fi
done
done
BASE_URL_A53="https://dl.openwrt.ai/$PACKAGE_VERSION/aarch64_cortex-a53/packages/"
wget -qO- "$BASE_URL_A53" | \
while IFS= read -r LINE; do
for PREFIX in "${FILE_PREFIXES[@]}"; do
if [[ "$LINE" == *"$PREFIX"* ]]; then
FILE=$(echo "$LINE" | grep -oP 'href="\K[^"]*')
if [[ -z "$FILE" ]]; then
# echo "No file found in line, skipping"
continue
fi
FILE_URL="${BASE_URL_A53}${FILE}"
echo "Found file: $FILE_URL"
curl -L --fail "$FILE_URL" -o "a53/depends/$(basename $FILE_URL)" -#
fi
done
done
- name: List depends ipks
run: |
echo "List x86 depends ipk files"
ls -lh x86_64/depends/
echo "List a53 depends ipk files"
ls -lh a53/depends/
mv x86_64/depends/luci-app-ssr-plus*.ipk x86_64
mv a53/depends/luci-app-ssr-plus*.ipk a53
- name: Create install.sh
run: |
echo -e "#!/bin/sh\n\nopkg update\nif [ \$? -ne 0 ]; then\n echo \"update failed\"\n exit 1\nfi\nopkg install depends/*.ipk --force-depends\nopkg install *.ipk --force-depends" > x86_64/install.sh
chmod +x x86_64/install.sh
cp x86_64/install.sh a53/
- name: Create self-extracting archives
run: |
mv -f x86_64 makeself
mv -f a53 makeself
cd makeself
ipk_file=$(ls x86_64/*.ipk)
appversion=$(basename "$ipk_file" | grep -oP '\d+\.\d+\.\d+')
echo "APP_VERSION=$appversion" >> $GITHUB_ENV
release_name=$(TZ="Asia/Shanghai" date +'%Y-%m-%d %H:%M Build')
echo "RELEASE_NAME=$release_name" >> $GITHUB_ENV
./makeself.sh x86_64/ ssrp_x86_64_$appversion.run "by github action" ./install.sh
./makeself.sh a53/ ssrp_aarch64_cortex-a53_$appversion.run "by github action" ./install.sh
- name: Upload all .run files to GitHub Release
uses: softprops/action-gh-release@v2.1.0
with:
tag_name: ${{ env.APP_VERSION }}
name: ${{ env.RELEASE_NAME }}
body: "![Github](https://img.shields.io/badge/SSRP.run-123456?logo=github&logoColor=fff&labelColor=blue&style=for-the-badge) [![Github](https://img.shields.io/badge/国内加速站下载-FC7C0D?logo=github&logoColor=fff&labelColor=000&style=for-the-badge)](https://wkdaily.cpolar.top/archives/1) ![GitHub Downloads (all assets, specific tag)](https://img.shields.io/github/downloads/wukongdaily/RunFilesBuilder/${{ env.APP_VERSION }}/total?style=for-the-badge&labelColor=black&color=%2325c2a0)"
files: makeself/*.run
token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}