diff --git a/.github/workflows/telegram-notify.yml b/.github/workflows/telegram-notify.yml new file mode 100644 index 000000000..4c1284c0b --- /dev/null +++ b/.github/workflows/telegram-notify.yml @@ -0,0 +1,104 @@ +name: Telegram Notify + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to notify (e.g. 2.4.7), defaults to package.json version' + required: false + type: string + build_type: + description: 'Build type' + required: false + default: 'release' + type: choice + options: + - release + - autobuild + +permissions: {} + +jobs: + notify-telegram: + name: Notify Telegram + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Fetch UPDATE logs + id: fetch_update_logs + run: bash ./scripts/extract_update_logs.sh + shell: bash + + - name: Install Node + uses: actions/setup-node@v6 + with: + node-version: '24.14.0' + + - uses: pnpm/action-setup@v5 + name: Install pnpm + with: + run_install: false + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Get Version and Release Info + run: | + if [ -n "${{ inputs.version }}" ]; then + VERSION="${{ inputs.version }}" + else + VERSION=$(jq -r '.version' package.json) + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "DOWNLOAD_URL=https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v${VERSION}" >> $GITHUB_ENV + echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV + + - name: Generate release.txt + run: | + if [ -z "$UPDATE_LOGS" ]; then + echo "No update logs found, using default message" + UPDATE_LOGS="More new features are now supported. Check for detailed changelog soon." + else + echo "Using found update logs" + fi + + cat > release.txt << EOF + $UPDATE_LOGS + + ## 下载地址 + + ### Windows (不再支持Win7) + #### 正常版本(推荐) + - [64位(常用)](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_x64-setup.exe) | [ARM64(不常用)](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_arm64-setup.exe) + + #### 内置Webview2版(体积较大,仅在企业版系统或无法安装webview2时使用) + - [64位](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_x64_fixed_webview2-setup.exe) | [ARM64](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_arm64_fixed_webview2-setup.exe) + + ### macOS + - [Apple M芯片](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_aarch64.dmg) | [Intel芯片](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_x64.dmg) + + ### Linux + #### DEB包(Debian系) 使用 apt ./路径 安装 + - [64位](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_amd64.deb) | [ARM64](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_arm64.deb) | [ARMv7](${{ env.DOWNLOAD_URL }}/Clash.Verge_${{ env.VERSION }}_armhf.deb) + + #### RPM包(Redhat系) 使用 dnf ./路径 安装 + - [64位](${{ env.DOWNLOAD_URL }}/Clash.Verge-${{ env.VERSION }}-1.x86_64.rpm) | [ARM64](${{ env.DOWNLOAD_URL }}/Clash.Verge-${{ env.VERSION }}-1.aarch64.rpm) | [ARMv7](${{ env.DOWNLOAD_URL }}/Clash.Verge-${{ env.VERSION }}-1.armhfp.rpm) + + ### FAQ + - [常见问题](https://clash-verge-rev.github.io/faq/windows.html) + + ### 稳定机场VPN推荐 + - [狗狗加速](https://verge.dginv.click/#/register?code=oaxsAGo6) + + Created at ${{ env.BUILDTIME }}. + EOF + + - name: Send Telegram Notification + run: node scripts/telegram.mjs + env: + TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} + BUILD_TYPE: ${{ inputs.build_type }} + VERSION: ${{ env.VERSION }} + DOWNLOAD_URL: ${{ env.DOWNLOAD_URL }}