Update dns #200
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: auto-update-release | |
on: | |
push: | |
branches: ['main'] | |
paths: ['dns'] | |
env: | |
ZIP_NAME: "turkish-ad-hosts-magisk-kernelsu-module" | |
REPO_URL: "https://github.com/symbuzzer/Turkish-Ad-Hosts" | |
REPO_RAW_URL: "https://raw.githubusercontent.com/symbuzzer/Turkish-Ad-Hosts" | |
HOSTS_NAME: "Turkish-Ad-Hosts" | |
MODULE_NAME: "Turkish Ad Hosts" | |
MODULE_VER: "1.0.6" | |
AUTHOR: "Ali Beyaz" | |
MODULE_DESC: "Türkiye'de yaygın kullanılan mobil uygulamalardaki (ve muhtemelen WEB sayfalarındaki) izleme (ve beraberinde muhtemelen reklam) ağlarını engellemek için gerekli hosts dosyası" | |
MODULE_DESC_EN: "Necessary hosts file to block tracking (and possibly advertising) networks in commonly used mobile applications (and possibly WEB pages) in Turkey..." | |
AUTHOR_WEB_PAGE: "https://avalibeyaz.com" | |
AUTHOR_EMAIL: "alipolatbeyaz@gmail.com" | |
LICENSE: "GPLv3" | |
FILTER_FORMAT: "Hosts" | |
PROJECT_START_DATE: "17/11/2022" | |
PROBLEMATIC_APPS_PAGE: "https://github.com/symbuzzer/Turkish-Ad-Hosts/issues?q=is%3Aissue+label%3A%22Sorunlu+uygulamalar+%2F+Problematic+apps%22+is%3Aopen" | |
WIKI_PAGE: "https://github.com/symbuzzer/Turkish-Ad-Hosts/wiki" | |
DISCUSSIONS_PAGE: "https://github.com/symbuzzer/Turkish-Ad-Hosts/discussions" | |
RELEASES_PAGE: "https://github.com/symbuzzer/Turkish-Ad-Hosts/releases" | |
ISSUES_PAGE: "https://github.com/symbuzzer/Turkish-Ad-Hosts/issues" | |
DONATE_URL: "https://avalibeyaz.com/patreon" | |
MODULE_FOLDER: "magisk-kernelsu" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set variables | |
run: | | |
echo "DATE=$(date +'%y%m%d%H')" >> $GITHUB_ENV | |
echo "DATE2=$(date +'%Y/%m/%d - %H:%S')" >> $GITHUB_ENV | |
echo "ZIP_URL=${{env.REPO_URL}}/releases/latest/download/${{env.ZIP_NAME}}.zip" >> $GITHUB_ENV | |
echo "UPDATEJSON_RAW_URL=${{env.REPO_RAW_URL}}/${GITHUB_REF##*/}/${{env.MODULE_FOLDER}}/update.json" >> $GITHUB_ENV | |
echo "MODULE_CHANGELOG_URL=${{env.REPO_RAW_URL}}/${GITHUB_REF##*/}/${{env.MODULE_FOLDER}}/changelog.md" >> $GITHUB_ENV | |
- name: Checkout | |
uses: symbuzzer/fork-checkout-repo@main | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Adding prefix to "hosts" file | |
run: | | |
echo -e "# Title: ${{env.MODULE_NAME}}\n# Author: ${{env.AUTHOR}}\n# Author web page: ${{env.AUTHOR_WEB_PAGE}}\n# Author e-mail: ${{env.AUTHOR_EMAIL}}\n# Description: ${{env.MODULE_DESC_EN}}\n# Homepage: ${{env.REPO_URL}}\n# Format: ${{env.FILTER_FORMAT}}\n# License: ${{env.LICENSE}}\n# Version: ${{ env.DATE }}\n# (Version also shows update date as YYMMDDHH)\n# Project start date: ${{env.PROJECT_START_DATE}}\n# Problematic apps: ${{env.PROBLEMATIC_APPS_PAGE}} \n# Wiki: ${{env.WIKI_PAGE}}\n# Discussions: ${{env.DISCUSSIONS_PAGE}}\n# Releases: ${{env.RELEASES_PAGE}}\n# Issues: ${{env.ISSUES_PAGE}}\n\n127.0.0.1 localhost\n\n# --- [ START ] --- #" > hosts | |
- name: Transfering DNS addresses from "dns" file to "hosts" file | |
run: | | |
sed -e 's/^/127.0.0.1 /' dns >> hosts | |
- name: Adding suffix to "hosts" file | |
run: | | |
echo -e "# --- [ END ] --- #" >> hosts | |
- name: Adding version string to "README.md" | |
run: | | |
sed -i "3s/.*/# Turkish Ad Hosts - v${DATE}/" README.md | |
- name: Creating directories | |
run: | | |
mkdir -p adguard | |
mkdir -p downloads | |
mkdir -p ${{env.MODULE_FOLDER}} | |
mkdir -p release | |
mkdir -p zip/system/etc | |
mkdir -p zip/common | |
mkdir -p zip/META-INF/com/google/android | |
- name: Downloading "Zackptg5/MMT-Extended-Next" template files from abit modified my own fork | |
run: | | |
cd downloads | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/uninstall.sh | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/customize.sh | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/LICENSE | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/common/functions.sh | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/common/install.sh | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/META-INF/com/google/android/update-binary | |
wget https://raw.githubusercontent.com/symbuzzer/MMT-Extended-Next/main/META-INF/com/google/android/updater-script | |
- name: Downloading "update.json" file | |
run: | | |
cd downloads | |
wget ${{ env.UPDATEJSON_RAW_URL }} | |
- name: Update "update.json" version | |
uses: symbuzzer/fork-action-set-json-field@master | |
with: | |
file: downloads/update.json | |
field: version | |
value: v${{ env.DATE }} | |
- name: Update "update.json" versionCode | |
uses: symbuzzer/fork-action-set-json-field@master | |
with: | |
file: downloads/update.json | |
field: versionCode | |
value: ${{ env.DATE }} | |
- name: Update "update.json" zipUrl | |
uses: symbuzzer/fork-action-set-json-field@master | |
with: | |
file: downloads/update.json | |
field: zipUrl | |
value: ${{ env.ZIP_URL }} | |
- name: Update "update.json" changelog | |
uses: symbuzzer/fork-action-set-json-field@master | |
with: | |
file: downloads/update.json | |
field: changelog | |
value: ${{ env.MODULE_CHANGELOG_URL }} | |
- name: Create "module.prop" file | |
run: | | |
echo "id=$HOSTS_NAME | |
name=$MODULE_NAME - v$MODULE_VER | |
version=v${{ env.DATE }} | |
versionCode=${{ env.DATE }} | |
author=$AUTHOR | |
description=$MODULE_DESC | |
updateJson=$UPDATEJSON_RAW_URL | |
support=$ISSUES_PAGE | |
donate=$DONATE_URL" > module.prop | |
- name: Copying files to necessary dirs | |
run: | | |
sudo cp downloads/update.json magisk-kernelsu/ | |
sudo cp hosts release/ | |
sudo cp hosts adguard/ | |
sudo cp windows/turkish-ad-hosts-windows.bat release/ | |
sudo cp hosts zip/system/etc/ | |
sudo cp ${{env.MODULE_FOLDER}}/update.json zip/ | |
sudo mv module.prop zip/ | |
sudo cp downloads/uninstall.sh zip/ | |
sudo cp downloads/customize.sh zip/ | |
sudo cp downloads/LICENSE zip/ | |
sudo cp downloads/functions.sh zip/common/ | |
sudo cp downloads/install.sh zip/common/ | |
sudo cp downloads/update-binary zip/META-INF/com/google/android/ | |
sudo cp downloads/updater-script zip/META-INF/com/google/android/ | |
ls -R | |
- name: Run @adguard/hostlist-compiler | |
run: | | |
cd adguard | |
npm i -g @adguard/hostlist-compiler | |
hostlist-compiler -c configuration.json -o filter.txt | |
- name: Copy adguard/filter.txt to releases | |
run: | | |
sudo cp adguard/filter.txt release/ | |
- name: Creating module zip | |
run: | | |
cd zip | |
sudo zip -r -m $ZIP_NAME.zip * | |
- name: Copy module zip to "release" folder | |
run: | | |
sudo cp zip/*.zip release/ | |
- name: Create "version" file | |
run: | | |
echo ${{ env.DATE }} > version | |
- name: Create and upload release asset | |
uses: symbuzzer/fork-github-release@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ env.DATE }} | |
name: v${{ env.DATE }} | |
body: DNS list updated to ${{ env.DATE2 }} | |
files: release/* | |
gzip: false | |
draft: false | |
prerelease: false | |
allow_override: true | |
- name: Cleanup before commit and push changes to github | |
run: | | |
rm -rf zip | |
rm -rf downloads | |
rm -rf release | |
rm -rf adguard/hosts | |
ls -R | |
- name: Commit and push changes | |
uses: symbuzzer/fork-push-changes@master | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |