-
-
Notifications
You must be signed in to change notification settings - Fork 6
196 lines (171 loc) · 8.03 KB
/
auto-update-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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 }}