sync_client.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Synchronize client
  2. on:
  3. workflow_dispatch:
  4. # schedule:
  5. # - cron: '18 2 * * *'
  6. jobs:
  7. WireGuard-go:
  8. name: Synchronize client
  9. runs-on: ubuntu-20.04
  10. env:
  11. FILE_DIR: Client
  12. steps:
  13. - name: Checkout code
  14. uses: actions/[email protected]
  15. with:
  16. fetch-depth: 0
  17. - name: Synchronize client to the latest version
  18. run: |
  19. NOW=$(wget -qO- "https://api.github.com/repos/${{ github.repository }}/releases" | grep "tag_name" | grep "CloudFlare" | head -n 1 | sed "s/.*_v\(.\{1,\}\)\".*/\1/g")
  20. LATEST=$(wget -qO- "https://pkg.cloudflareclient.com/packages/cloudflare-warp" | grep "release-row" | awk -F '</td><td>' {'print $1'} | awk -F '<td>' {'print $2'})
  21. Operating_System=("CentOS 8" "Debian Bullseye" "Debian Buster" "Debian Stretch" "Ubuntu Jammy" "Ubuntu Focal" "Ubuntu Bionic" "Ubuntu Xenial")
  22. System_Rename=("CentOS_8.rpm" "Debian_11.deb" "Debian_10.deb" "Debian_9.deb" "Ubuntu_22.04.deb" "Ubuntu_20.04.deb" "Ubuntu_18.04.deb" "Ubuntu_16.04.deb")
  23. if [ "$LATEST" != "$NOW" ]; then
  24. [ ! -d ${{ env.FILE_DIR }} ] && mkdir -p ${{ env.FILE_DIR }}
  25. for ((i=0; i<${#Operating_System[@]}; i++)); do
  26. File_Path=$(wget -qO- https://pkg.cloudflareclient.com/packages/cloudflare-warp | grep 'release-row' | awk -F "</td><td>${Operating_System[i]}" {'print $2'} | awk -F 'Download' {'print $1'} | awk -F \" {'print $2'})
  27. Download_URL="https://pkg.cloudflareclient.com$File_Path"
  28. wget -O ${{ env.FILE_DIR }}/Client_${System_Rename[i]} $Download_URL
  29. done
  30. echo "VERSION=$LATEST" >> $GITHUB_ENV
  31. echo "DATE=$(date "+%Y/%m/%d %H:%M:%S")" >> $GITHUB_ENV
  32. fi
  33. - name: Upload to repository
  34. uses: stefanzweifel/[email protected]
  35. if: ${{ env.VERSION != '' }}
  36. with:
  37. commit_message: Sync Client to V${{ env.VERSION }} by Github Actions, ${{ env.DATE }}
  38. - name: Release binaries
  39. uses: softprops/action-gh-release@v1
  40. if: ${{ env.VERSION != '' }}
  41. with:
  42. tag_name: CloudFlare_Client_v${{ env.VERSION }}
  43. files: ${{ env.FILE_DIR }}/Client*