-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
132 lines (116 loc) · 5.41 KB
/
compile_new_ipk.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
name: Compile The New Version OpenClash
on:
push:
branches:
- dev
paths:
- 'luci-app-openclash/Makefile'
workflow_dispatch:
jobs:
Get-Version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
current_version: ${{ steps.current_version.outputs.version }}
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: New Version
id: version
run: |
echo "version=$(grep 'PKG_VERSION:=' ./luci-app-openclash/Makefile |awk -F '=' '{print $2}')" >> $GITHUB_OUTPUT
echo "New Version: $(grep 'PKG_VERSION:=' ./luci-app-openclash/Makefile |awk -F '=' '{print $2}')"
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: package
- name: Current Version
id: current_version
run: |
echo "version=$(sed -n 1p ./${{ github.ref_name }}/version |awk -F 'v' '{print $2}')" >> $GITHUB_OUTPUT
echo "Current Version: $(sed -n 1p ./${{ github.ref_name }}/version |awk -F 'v' '{print $2}')"
Compile:
runs-on: ubuntu-latest
needs: Get-Version
if: ${{ needs.Get-Version.outputs.version != needs.Get-Version.outputs.current_version }}
steps:
- name: Clone OpenClash dev Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Apt Update
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get -y install curl git tar zstd
- name: Install OpenWrt SDK
run: |
cd ..
mkdir tmp
curl -SLk --connect-timeout 30 --retry 2 "https://archive.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/OpenWrt-SDK-15.05.1-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2" -o "./tmp/SDK.tar.bz2"
cd \tmp
tar xjf SDK.tar.bz2
mv "OpenWrt-SDK-15.05.1-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64" "SDK"
- name: Install OpenWrt SNAPSHPT SDK
run: |
cd ..
curl -SLk --connect-timeout 30 --retry 2 "https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst" -o "./tmp/SNAPSDK.tar.zst"
cd \tmp
zstd -d SNAPSDK.tar.zst
tar xf SNAPSDK.tar
mv "openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64" "SNAPSDK"
- name: Copy OpenClash Source Codes
run: |
cd ..
mkdir -p tmp/SDK/package/luci-app-openclash
mkdir -p tmp/SNAPSDK/package/luci-app-openclash
cp -rf "./OpenClash/luci-app-openclash/." "./tmp/SDK/package/luci-app-openclash/"
cp -rf "./OpenClash/luci-app-openclash/." "./tmp/SNAPSDK/package/luci-app-openclash/"
- name: Compile po2lmo
run: |
cd ..
cd tmp/SDK/package/
pushd luci-app-openclash/tools/po2lmo
make && sudo make install
popd
cd ../../..
cd tmp/SNAPSDK/package/
pushd luci-app-openclash/tools/po2lmo
make && sudo make install
popd
- name: Compile OpenClash IPK
run: |
cd ..
cd tmp/SDK
make package/luci-app-openclash/compile V=99
- name: Compile OpenClash APK
run: |
cd ..
cd tmp/SNAPSDK
make defconfig
make package/luci-app-openclash/compile V=99
- name: Switch OpenClash Repository to Package
uses: actions/checkout@v4
with:
ref: package
- name: Commit and Push New Version
run: |
rm -rf ./${{ github.ref_name }}/luci-app-openclash*
echo "v${{ needs.Get-Version.outputs.version }}" > ./${{ github.ref_name }}/version
echo "https://img.shields.io/badge/New Release-v${{ needs.Get-Version.outputs.version }}-orange.svg" >> ./${{ github.ref_name }}/version
cd ..
cp "./tmp/SDK/bin/ar71xx/packages/base/luci-app-openclash_${{ needs.Get-Version.outputs.version }}_all.ipk" "./OpenClash/${{ github.ref_name }}/luci-app-openclash_${{ needs.Get-Version.outputs.version }}_all.ipk"
cp "./tmp/SNAPSDK/bin/packages/x86_64/base/luci-app-openclash-${{ needs.Get-Version.outputs.version }}.apk" "./OpenClash/${{ github.ref_name }}/luci-app-openclash-${{ needs.Get-Version.outputs.version }}.apk"
sed -i -E "s/OpenClash\/tree\/v(.*)/OpenClash\/tree\/v${{ needs.Get-Version.outputs.version }}/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/OpenClash\/releases\/tag\/v(.*)/OpenClash\/releases\/tag\/v${{ needs.Get-Version.outputs.version }}/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/source code-v(.*)-green/source code-v${{ needs.Get-Version.outputs.version }}-green/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/New Release-v(.*)-orange/New Release-v${{ needs.Get-Version.outputs.version }}-orange/g" ./OpenClash/${{ github.ref_name }}/README.md
cd \OpenClash
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Auto Release: v${{ needs.Get-Version.outputs.version }}"
git push