diff --git a/.github/workflows/adblock.yml b/.github/workflows/adblock.yml index d41990aee..0235751c0 100644 --- a/.github/workflows/adblock.yml +++ b/.github/workflows/adblock.yml @@ -133,12 +133,13 @@ jobs: #git remote set-url --add origin "https://${{ secrets.CODING_ACCOUNT }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/${{ secrets.CODING_NAME }}/list.git" git push -u -f origin master - - name: Purge jsdelivr cache + - name: Release and Upload Assets if: steps.diffResult.outputs.status == 'success' - run: | - result=$(curl -s https://purge.jsdelivr.net/gh/o0HalfLife0o/list@master/) - if echo $result |grep -q 'success.*true'; then - echo "jsdelivr缓存更新成功" - else - echo $result - fi + uses: ncipollo/release-action@v1 + with: + name: ${{ env.RELEASE_NAME }} + tag: adblock + allowUpdates: true + removeArtifacts: true + artifacts: | + *.txt diff --git a/.github/workflows/smartdns.yml b/.github/workflows/smartdns.yml new file mode 100644 index 000000000..2eda6467f --- /dev/null +++ b/.github/workflows/smartdns.yml @@ -0,0 +1,46 @@ +name: Smartdns Rules +on: + schedule: + - cron: 0 20 * * * + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Set Variables + run: | + echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV + echo "anti_ad_domains=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV + echo "anti_ad_domains_whitelist=https://raw.githubusercontent.com/privacy-protection-tools/dead-horse/master/anti-ad-white-list.txt" >> $GITHUB_ENV + echo "direct_list=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt" >> $GITHUB_ENV + echo "gfw_list=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt" >> $GITHUB_ENV + echo "greatfire_list=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt" >> $GITHUB_ENV + + - name: Get every files + run: | + curl -sSL $anti_ad_domains |sed '/^#/d' > anti_ad_domains.txt + curl -sSL $anti_ad_domains_whitelist |sed '/^#/d' > anti_ad_domains_whitelist.txt + curl -sSL $direct_list |sed -e '/^#/d' -e '/^regexp:/d' -e 's#^full:##' > direct_list.txt + curl -sSL $gfw_list |sed '/^#/d' > gfw_list.txt + curl -sSL $greatfire_list |sed '/^#/d' > greatfire_list.txt + cat gfw_list.txt greatfire_list.txt |sort -u > gfw.txt + rm -f gfw_list.txt greatfire_list.txt + + - name: Generate sha256sum + run: | + for i in $(ls *.txt); do + sha256sum $i > $i.sha256sum + done + + - name: Release and Upload Assets + uses: ncipollo/release-action@v1 + with: + name: ${{ env.RELEASE_NAME }} + tag: smartdns + allowUpdates: true + removeArtifacts: true + artifacts: | + *.txt + *.txt.sha256sum diff --git a/.github/workflows/yuedu.yml b/.github/workflows/yuedu.yml deleted file mode 100644 index 71cdfe51a..000000000 --- a/.github/workflows/yuedu.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Build YueDu Sources files -on: - schedule: - - cron: 30 21 * * * -# push: -# branches: -# - "master" - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Setup Go 1.x - uses: actions/setup-go@v3 - with: - go-version: "^1.14" - - - name: Set $GOPATH and more variables - run: | - echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV - echo "TAG_NAME=$(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV - echo "SHUYUAN_INDEX_URL=http://yck.mumuceo.com/yuedu/shuyuan/index.html" >> $GITHUB_ENV - echo "SHUYUAN_JSON_URL=http://yck.mumuceo.com/yuedu/shuyuan/jsons" >> $GITHUB_ENV - echo "RSSYUAN_INDEX_URL=http://yck.mumuceo.com/yuedu/rssyuan/index.html" >> $GITHUB_ENV - echo "RSSYUAN_JSON_URL=http://yck.mumuceo.com/yuedu/rssyuan/jsons" >> $GITHUB_ENV - echo "HOMEPAGE='Origin: http://yck.mumuceo.com'" >> $GITHUB_ENV - echo "REFERER='Referer: http://yck.mumuceo.com/yuedu/index/index.html'" >> $GITHUB_ENV - echo "USERAGENT='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0'" >> $GITHUB_ENV - echo "ACCEPTLANGUAGE='Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2'" >> $GITHUB_ENV - echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV - echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH - shell: bash - - - name: Checkout the "master" branch - uses: actions/checkout@v3 - with: - ref: master - - - name: Get ShuYuan files - run: | - mkdir -p ./download/ - mkdir -p ./new/ - cd ./download - #检索最新有搜索无声的书源id - curl -sSL "$SHUYUAN_INDEX_URL" -H "$USERAGENT" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "$ACCEPTLANGUAGE" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "X-Requested-With: XMLHttpRequest" -H "$HOMEPAGE" -H "Connection: keep-alive" -H "$REFERER" --data "page=1&limit=5000&keys=&ver=3&sousuo=1&faxian=&audio=0&tupian=0" |grep -o '\"id\":[0-9]\+' |sed 's#\"id\":##' >yuedu-all.txt - #把书源id文件分割成每400行一个 - split -l 400 yuedu-all.txt yueduid - #获取书源文件 - for i in $(ls yueduid*);do - curl -s -o $i.txt "$SHUYUAN_JSON_URL?id=$(sed ':a;N;s/\n/-/g;ta' $i)" -H "$USERAGENT" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "$ACCEPTLANGUAGE" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" - sed -i -e 's#^\[#,#' -e 's#\]$##' $i.txt - done - #合并书源文件 - cat yueduid*.txt |sed -e 's#^,#\[#' -e 's#$#\]#' > ../new/yuedu.txt - rm -rf ../download - - - name: Get RSSYuan files - run: | - mkdir -p ./download/ - cd ./download - #检索订阅源id - curl -s "$RSSYUAN_INDEX_URL" -H "$USERAGENT" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "$ACCEPTLANGUAGE" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "X-Requested-With: XMLHttpRequest" -H "$HOMEPAGE" -H "Connection: keep-alive" -H "$REFERER" --data "page=1&limit=5000&keys=" |grep -o '\"id\":[0-9]\+' |sed 's#\"id\":##' >yuedu-all.txt - #把订阅源id文件分割成每400行一个 - split -l 400 yuedu-all.txt yueduid - #获取订阅源文件 - for i in $(ls yueduid*);do - curl -s -o $i.txt "$RSSYUAN_JSON_URL?id=$(sed ':a;N;s/\n/-/g;ta' $i)" -H "$USERAGENT" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "$ACCEPTLANGUAGE" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" - sed -i -e 's#^\[#,#' -e 's#\]$##' $i.txt - done - #合并订阅源文件 - cat yueduid*.txt |sed -e 's#^,#\[#' -e 's#$#\]#' > ../new/yuedu-rss.txt - rm -rf ../download - - - name: Check and diff - id: diffResult - run: | - cd ./new - for i in $(ls *.txt); do - if [ -s $i ]; then - fileSum=$(sha256sum $i |sed 's# .*##') - if ! echo "$fileSum ../$i"|sha256sum -c --status; then - cp -f $i ../$i - echo "::set-output name=status::success" - fi - fi - done - - - name: Git push assets to "master" branch - if: steps.diffResult.outputs.status == 'success' - run: | - rm -rf download new - sed -i '/url =/d' ./.git/config - git config --local user.name "actions" - git config --local user.email "action@github.com" - git add --all - git commit -m "${{ env.RELEASE_NAME }}" - git remote set-url --add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" - git push -u origin master