From 5694a2d12fbc70a47b1acaa70d1a7a52e0822608 Mon Sep 17 00:00:00 2001 From: powerAn <25736019+powerAn2020@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96=201.?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E7=AE=A1=E7=90=86=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E6=88=90=E5=91=98=E9=BB=98=E8=AE=A4=E5=B1=95=E7=A4=BA=E7=9F=AD?= =?UTF-8?q?=E6=98=B5=E7=A7=B0=202.=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1=E5=90=8E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E7=8A=B6=E6=80=81=E6=A0=8F=203.=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=B5=81=E6=B0=B4=E7=BA=BF=E6=A3=80=E6=9F=A5=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/debug.yml | 140 -------------------------------- .github/workflows/dev_build.yml | 5 ++ .github/workflows/release.yml | 27 ++---- ui-src/src/NetworkDetail.vue | 17 ++-- ui-src/src/Setting.vue | 1 + ui-src/src/locales/en-US.json | 2 +- ui-src/src/locales/zh-CN.json | 4 +- 7 files changed, 25 insertions(+), 171 deletions(-) delete mode 100644 .github/workflows/debug.yml diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index 5c1b53e..0000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: debug -# description: - -on: - workflow_dispatch: - schedule: - - cron: '25 9 * * 2' - # push: - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - fetch-depth: 0 - - - name: Initialization environment - env: - DEBIAN_FRONTEND: noninteractive - run: | - sudo apt install -y xz-utils make git wget zip - echo "${{ github.action_path }}" - latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/stunnel/static-curl/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1) - module_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/powerAn2020/ZeroTierOneForKSU/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1) - zerotier_latest_version=$(wget --no-check-certificate -qO- "https://api.github.com/repos/zerotier/ZeroTierOne/releases" | grep "tag_name" | grep -oE "[0-9.]*" | head -1) - zerotier_version=$(cat zerotier_version) - echo "${zerotier_version}=${zerotier_latest_version}" - if [ "$zerotier_latest_version" = "$zerotier_version" -a "${{github.event_name }}" = "schedule" ]; then - echo "COMMIT=0" >> $GITHUB_ENV - echo "SKIP_NEXT=true" >> $GITHUB_ENV - exit 0 - fi - echo ${zerotier_latest_version}>zerotier_version - echo "VERSION=$zerotier_latest_version" >> $GITHUB_ENV - download_link="https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-aarch64-musl-${latest_version}.tar.xz" - echo ${download_link} - wget -O curl.tar.xz ${download_link} - wget -O curl32.tar.xz https://github.com/stunnel/static-curl/releases/download/${latest_version}/curl-linux-armv7-musl-${latest_version}.tar.xz - tar -xJf curl.tar.xz -C $PWD/bin curl - tar -xJf curl32.tar.xz curl - wget -O $PWD/bin/cacert.pem https://curl.se/ca/cacert.pem - mkdir $PWD/toolchain - wget -O arm64.tar.xz "https://dl.armbian.com/_toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz" - wget -O arm.tar.xz "https://dl.armbian.com/_toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz" - xz -d arm64.tar.xz - xz -d arm.tar.xz - tar -xvf arm64.tar -C $PWD/toolchain - tar -xvf arm.tar -C $PWD/toolchain - rm -f arm64.tar arm.tar curl.tar.xz curl32.tar.xz - - - name: Update versionCode - if: ${{ env.SKIP_NEXT != 'true' }} - run: | - module_version=$(grep -w 'version' module.prop |awk -F'=' '{print $2}') - module_versionCode=$(grep -w 'versionCode' module.prop |awk -F'=' '{print $2}') - zerotier_version=$(cat zerotier_version) - # if [[ "${{ env.VERSION }}" != "${zerotier_version}" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then - # echo "Scheduled event triggered this workflow" - versionCode=$(expr 10000 + $(git rev-list --count HEAD) + 200) - echo "MODULE_VERSION=$versionCode" >> $GITHUB_ENV - echo '{"version":"${{ env.VERSION }}","versionCode":'${versionCode}',"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/'${versionCode}'/ZeroTierForKSU-arm64-'${versionCode}'.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}' >update_arm64.json - echo '{"version":"${{ env.VERSION }}","versionCode":'${versionCode}',"zipUrl":"https://github.com/powerAn2020/ZeroTierOneForKSU/releases/download/'${versionCode}'/ZeroTierForKSU-arm-'${versionCode}'.zip","changelog":"https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/changelog.md"}' >update_arm.json - echo 'id=ZeroTierForKSU' >module.prop - echo 'name=ZeroTier For KernelSU' >>module.prop - echo "version=${{ env.VERSION }}(${versionCode})" >>module.prop - echo "versionCode=${versionCode}" >>module.prop - echo 'author=powerAn2020' >>module.prop - echo 'description=ZeroTier(${{ env.VERSION }}) with UI interface' >>module.prop - git config --global user.email "action@example.com" - git config --global user.name "github action" - MESSAGE=$(git log -1 --pretty=%B) - echo "commit MESSAGE: $MESSAGE" - echo '## Module Changelog' > changelog.md - echo $MESSAGE >> changelog.md - wget -O RELEASE-NOTES.md https://github.com/zerotier/ZeroTierOne/raw/dev/RELEASE-NOTES.md - release_notes_line=$(grep -nPo '\d{4}-\d{2}-\d{2} -- Version [\d.]+' RELEASE-NOTES.md|head -2|awk -F ':' '{print $1}'|awk BEGIN{RS=EOF}'{gsub(/\n/," ");print}'|awk '{printf("start=%s; end=%s;",$1,$2)}') - eval $release_notes_line - end=$(expr ${end} - 1) - echo " ===================" >>changelog.md - echo "## Zerotier Changelog" >>changelog.md - sed -n "${start},${end}p" RELEASE-NOTES.md >>changelog.md - rm RELEASE-NOTES.md - if [[ "${{ env.VERSION }}" != "${zerotier_version}" ]];then - echo "${{ env.VERSION }}" > zerotier_version - git add zerotier_version - fi - git add module.prop update_arm64.json update_arm.json changelog.md zerotier_version - git commit -m "update config" - echo "COMMIT=1" >> $GITHUB_ENV - # else - # echo "no need commit" - # exit 0 - # fi - - - name: Build Zerotier for arm64 - if: ${{ env.SKIP_NEXT != 'true' }} - run: | - export PATH="$PWD/toolchain/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin/:${PATH}" - git clone https:///github.com/zerotier/ZeroTierOne.git --depth=1 -b ${{ env.VERSION }} - cp -rf ZeroTierOne ZeroTierOne_ARM - cd ZeroTierOne - make -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ LDFLAGS="-s" - cp -rf zerotier-one ../zerotier-one-arm64 - - - name: Build Zerotier for arm - if: ${{ env.SKIP_NEXT != 'true' }} - run: | - export PATH="$PWD/toolchain/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf/bin/:${PATH}" - cd ZeroTierOne_ARM - make -j $(nproc) ZT_STATIC=1 ZT_DEBUG=0 CC=arm-none-linux-gnueabihf-gcc CXX=arm-none-linux-gnueabihf-g++ LDFLAGS="-s" - cp -rf zerotier-one ../zerotier-one-arm - - - name: Build UI - if: ${{ env.SKIP_NEXT != 'true' }} - run: | - cd ui-src - npm install - npm audit fix - npm run build - mv dist/* ../webroot/ - - - name: Generate module for arm64/arm - if: ${{ env.SKIP_NEXT != 'true' }} - run: | - mv zerotier-one-arm64 zerotier-one - echo 'updateJson=https://raw.githubusercontent.com/powerAn2020/ZeroTierOneForKSU/main/update_arm64.json' >>module.prop - echo 'arch=arm64' >>module.prop - ls -la - bash build.sh ZeroTierForKSU-arm64-${{ env.MODULE_VERSION }}.zip - mv -f zerotier-one-arm zerotier-one - mv -f curl bin/curl - sed -i "s/update_arm64/update_arm/g" module.prop - sed -i "s/arm64/arm/g" module.prop - bash build.sh ZeroTierForKSU-arm-${{ env.MODULE_VERSION }}.zip \ No newline at end of file diff --git a/.github/workflows/dev_build.yml b/.github/workflows/dev_build.yml index adb3326..967158f 100644 --- a/.github/workflows/dev_build.yml +++ b/.github/workflows/dev_build.yml @@ -19,6 +19,11 @@ permissions: jobs: build: runs-on: ubuntu-latest + env: + COMMIT: 0 + SKIP_NEXT: false + VERSION: + MODULE_VERSION: steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d09a405..b10a484 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ name: release on: workflow_dispatch: schedule: - - cron: '40 7 * * 2' + - cron: '40 15 * * *' # push: permissions: @@ -13,6 +13,10 @@ permissions: jobs: build: runs-on: ubuntu-latest + env: + SKIP_NEXT: false + VERSION: + MODULE_VERSION: steps: - name: Checkout uses: actions/checkout@v4 @@ -32,7 +36,6 @@ jobs: zerotier_version=$(cat zerotier_version) echo "${zerotier_version}=${zerotier_latest_version}" if [ "$zerotier_latest_version" = "$zerotier_version" -a "${{github.event_name }}" = "schedule" ]; then - echo "COMMIT=0" >> $GITHUB_ENV echo "SKIP_NEXT=true" >> $GITHUB_ENV exit 0 fi @@ -92,7 +95,6 @@ jobs: fi git add module.prop update_arm64.json update_arm.json changelog.md zerotier_version git commit -m "update config" - echo "COMMIT=1" >> $GITHUB_ENV # else # echo "no need commit" # exit 0 @@ -148,9 +150,9 @@ jobs: ./ZeroTierForKSU-arm64-${{ env.MODULE_VERSION }}.zip ./ZeroTierForKSU-arm-${{ env.MODULE_VERSION }}.zip - - name: Schedule Release + - name: Release uses: softprops/action-gh-release@v2 - if: github.event_name == 'schedule' && ${{ env.COMMIT == '1' }} + if: ${{ env.SKIP_NEXT != 'true' }} with: body_path: changelog.md tag_name: ${{ env.MODULE_VERSION }} @@ -159,20 +161,9 @@ jobs: ZeroTierForKSU-arm64-${{ env.MODULE_VERSION }}.zip ZeroTierForKSU-arm-${{ env.MODULE_VERSION }}.zip - - name: Manual Release - uses: softprops/action-gh-release@v2 - if: github.event_name == 'workflow_dispatch' - with: - generate_release_notes: true - tag_name: ${{ env.MODULE_VERSION }} - name: ZeroTierForKSU-${{ env.MODULE_VERSION }} - files: | - ZeroTierForKSU-arm64-${{ env.MODULE_VERSION }}.zip - ZeroTierForKSU-arm-${{ env.MODULE_VERSION }}.zip - - name: Push changes uses: ad-m/github-push-action@master - if: ${{ env.COMMIT == '1' }} + if: ${{ env.SKIP_NEXT != 'true' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: main + branch: main diff --git a/ui-src/src/NetworkDetail.vue b/ui-src/src/NetworkDetail.vue index 55b9874..84c75f6 100644 --- a/ui-src/src/NetworkDetail.vue +++ b/ui-src/src/NetworkDetail.vue @@ -32,7 +32,7 @@ - +