fix error #183
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
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 |