Skip to content

Commit

Permalink
chore: test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Feb 22, 2023
1 parent d210ffa commit 560c942
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 2 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/compile_new_ipk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@

name: Compile The New Version OpenClash

on:
push:
branches:
- master
- dev
paths:
- 'version'

jobs:
Get-Version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}

- name: New Version
id: version
run: |
echo "version=$(sed -n 1p ./version |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}')" >> $GITHUB_OUTPUT
echo $(sed -n 1p ./version |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}')
Compile:
runs-on: ubuntu-latest
needs: Get-Version
steps:
- name: Clone Repository
uses: actions/checkout@v3
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 SDK
run: |
cd ..
mkdir tmp
curl -SLk --connect-timeout 30 --retry 2 "https://archive.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2" -o "./tmp/SDK.tar.bz2"
cd \tmp
tar xjf SDK.tar.bz2
mv "OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64" "SDK"
- name: Copy Source Code
run: |
cd ..
mkdir tmp/SDK/package/luci-app-openclash
cp -rf "./OpenClash/luci-app-openclash/." "./tmp/SDK/package/luci-app-openclash/"
cp "./OpenClash/version" "./tmp/version"
- name: Change Version IMG
run: |
cd ..
sed -i "/.*PKG_VERSION:=*/c\PKG_VERSION:=${{ needs.Get-Version.outputs.version }}" ./tmp/SDK/package/luci-app-openclash/Makefile
curl -SLk --connect-timeout 30 --retry 2 "https://img.shields.io/badge/Current%20Version-v${{ needs.Get-Version.outputs.version }}--beta-blue.svg" -o "./tmp/SDK/package/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg"
- name: Compile po2lmo
run: |
cd ..
cd tmp/SDK/package/
pushd luci-app-openclash/tools/po2lmo
make && sudo make install
popd
- name: Compile IPK
run: |
cd ..
cd tmp/SDK
make package/luci-app-openclash/compile V=99
- name: Switch Repository
uses: actions/checkout@v3
with:
ref: package

- name: Commit and push
run: |
rm -rf ./${{ github.ref_name }}/luci-app-openclash_*
cd ..
cp "./tmp/version" "./OpenClash/${{ github.ref_name }}/version"
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
git config user.email [email protected]
git add .
git commit -m "Auto Release: v${{ needs.Get-Version.outputs.version }}-beta"
git push
4 changes: 2 additions & 2 deletions version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v0.45.89-beta
https://img.shields.io/badge/New Release-v0.45.89--beta-orange.svg
v0.45.88-beta
https://img.shields.io/badge/New Release-v0.45.88--beta-orange.svg

0 comments on commit 560c942

Please sign in to comment.