-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
108 lines (94 loc) · 4.39 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
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 '-' '{print $1}' |awk -F 'v' '{print $2}')" >> $GITHUB_OUTPUT
echo "Current Version: $(sed -n 1p ./${{ github.ref_name }}/version |awk -F '-' '{print $1}' |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
- 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: Copy OpenClash Source Codes
run: |
cd ..
mkdir tmp/SDK/package/luci-app-openclash
cp -rf "./OpenClash/luci-app-openclash/." "./tmp/SDK/package/luci-app-openclash/"
- name: Compile po2lmo
run: |
cd ..
cd tmp/SDK/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: 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 }}-beta" > ./${{ github.ref_name }}/version
echo "https://img.shields.io/badge/New Release-v${{ needs.Get-Version.outputs.version }}--beta-orange.svg" >> ./${{ github.ref_name }}/version
cd ..
cp "./tmp/SDK/bin/ar71xx/packages/base/luci-app-openclash_${{ needs.Get-Version.outputs.version }}-beta_all.ipk" "./OpenClash/${{ github.ref_name }}/luci-app-openclash_${{ needs.Get-Version.outputs.version }}-beta_all.ipk"
sed -i -E "s/OpenClash\/tree\/v(.*)-beta/OpenClash\/tree\/v${{ needs.Get-Version.outputs.version }}-beta/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/OpenClash\/releases\/tag\/v(.*)-beta/OpenClash\/releases\/tag\/v${{ needs.Get-Version.outputs.version }}-beta/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/source code-v(.*)--beta-green/source code-v${{ needs.Get-Version.outputs.version }}--beta-green/g" ./OpenClash/${{ github.ref_name }}/README.md
sed -i -E "s/New Release-v(.*)--beta-orange/New Release-v${{ needs.Get-Version.outputs.version }}--beta-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 }}-beta"
git push