Compile The New Version Adguardhome #6
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 Adguardhome | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'lluci-app-adguardhome/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@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: New Version | |
id: version | |
run: | | |
echo "version=$(grep 'PKG_VERSION:=' ./luci-app-adguardhome/Makefile |awk -F '=' '{print $2}')" >> $GITHUB_OUTPUT | |
echo "New Version: $(grep 'PKG_VERSION:=' ./luci-app-adguardhome/Makefile |awk -F '=' '{print $2}')" | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
- 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@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 wget | |
- name: Install OpenWrt SDK | |
run: | | |
cd .. | |
mkdir tmp | |
curl -SLk --connect-timeout 30 --retry 2 "https://archive.openwrt.org/releases/23.05.3/targets/x86/64/openwrt-sdk-23.05.3-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz" -o "./tmp/SDK.tar.xz" | |
cd \tmp | |
tar xf SDK.tar.xz | |
mv "openwrt-sdk-23.05.3-x86-64_gcc-12.3.0_musl.Linux-x86_64" "SDK" | |
- name: Change Source Codes Version | |
run: | | |
echo "v${{ needs.Get-Version.outputs.version }}-beta" > ./version | |
echo "https://img.shields.io/badge/New Release-v${{ needs.Get-Version.outputs.version }}--beta-orange.svg" >> ./version | |
- name: Copy Source Codes | |
run: | | |
cd .. | |
mkdir tmp/SDK/package/luci-app-adguardhome | |
cp -rf "./luci-app-adguardhome/." "./tmp/SDK/package/luci-app-adguardhome/" | |
- name: Compile IPK | |
run: | | |
cd .. | |
cd tmp/SDK | |
make package/luci-app-adguardhome/compile V=99 | |
- name: Commit and Push New Version | |
run: | | |
rm -rf ./luci-app-adguardhome_* | |
cd .. | |
cp "./tmp/SDK/bin/x86_64/packages/base/luci-app-adguardhome_${{ needs.Get-Version.outputs.version }}-beta_all.ipk" "./xiaoxiao29/luci-app-adguardhome_${{ needs.Get-Version.outputs.version }}-beta_all.ipk" | |
cd \xiaoxiao29 | |
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 | |
- name: Switch Repository to Package | |
uses: actions/checkout@v3 | |
with: | |
ref: package |