Skip to content

Commit bdfcd9a

Browse files
authored
rework pipeline (#913)
* move LICENSE.md -> LICENSE * add contribs dir * remove utilities dir, requests & new icons * update gitignore * move header.svg to images * update variables.sh * add new requests updater * convert requests.txt to requests.yml * remove redundant stuff in requests_parser.py * update scripts, workflow; remove old requests * Auto-update requests.yml * rewrite paths in scripts * add shebangs * restore sort_drawable.py * lf endings * lf endings * remove push trigger * scripts refactoring, etc. * add appfilter sorting * move icons to new dir --------- Co-authored-by: flameshikari <[email protected]>
1 parent 6df43ab commit bdfcd9a

File tree

153 files changed

+13194
-25321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+13194
-25321
lines changed

.github/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Don't forget to give yourself an entry at the bottom of [app/src/main/res/xml/co
5050

5151
> **This method is only for adding new icons or linking ComponentInfo(s) with existing icons!**
5252
53-
1. Add `new_icon.svg` and `new_icon.png` to [resources/utilities/icons](../../../tree/master/resources/utilities/icons) directory
53+
1. Add `new_icon.svg` and `new_icon.png` to [contribs/icons](../../../tree/master/contribs/icons) directory
5454

55-
2. Append the icon name with ComponentInfo(s) to [resources/new_icons.yaml](https://github.com/Delta-Icons/android/blob/master/resources/new_icons.yaml) with any of the next formats:
55+
2. Append the icon name with ComponentInfo(s) to [contribs/icons.yml](https://github.com/Delta-Icons/android/blob/master/contribs/icons.yml) with any of the next formats:
5656

5757
2.1. The new icon with the ComponentInfo.
5858

@@ -158,7 +158,7 @@ If the existing icon rebranded, don't overwrite it with a new one, do the follow
158158

159159
## Requests
160160

161-
If you wanna help close icon requests from users, you can take a look at [resources/requests.txt](../../../tree/master/resources/requests.txt) where all requests are stored. The file updates periodically.
161+
If you wanna help close icon requests from users, you can take a look at [contribs/requests.yml](../../../tree/master/contribs/requests.yml) where all requests are stored. The file updates periodically.
162162

163163
## Gathering ComponentInfo
164164

.github/README.md

+51-53
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,51 @@
1-
<p align="center">
2-
<img width="200" src="./header.svg"/>
3-
</p>
4-
5-
<h2 align="center" padding="100">Delta Icons for Android</h2>
6-
7-
<p align="center">
8-
<a href="../../../releases/latest">
9-
<img src="https://img.shields.io/github/v/release/Delta-Icons/android?labelColor=56595b&color=a6c6ff&logo=github&logoColor=ffffff&label=release&style=for-the-badge"/>
10-
</a>
11-
12-
<a href="../../../releases">
13-
<img src="https://img.shields.io/github/v/release/Delta-Icons/android?labelColor=56595b&color=f8c28d&logo=github&logoColor=ffffff&include_prereleases&label=beta&style=for-the-badge"/>
14-
</a>
15-
16-
<a href="https://play.google.com/store/apps/details?id=website.leifs.delta">
17-
<img src="https://img.shields.io/static/v1?labelColor=56595b&color=97db99&logo=google-play&logoColor=ffffff&label=google play&style=for-the-badge&message=get"/>
18-
</a>
19-
20-
<a href="https://f-droid.org/packages/website.leifs.delta.foss">
21-
<img src="https://img.shields.io/static/v1?labelColor=56595b&color=f9de81&logo=f-droid&logoColor=ffffff&label=f-droid&style=for-the-badge&message=get"/>
22-
</a>
23-
</p>
24-
25-
## Contributing
26-
27-
Please refer to **[contribution guidelines](./CONTRIBUTING.md)**.
28-
29-
30-
## Discord
31-
32-
✋ The server is **not** intended for requests!
33-
34-
👋 If you need help contributing or just want to chat with other contributors feel free to **[join us](https://discord.gg/F9RFqHN)**!
35-
36-
<p align="center">
37-
<a href="https://discord.gg/F9RFqHN">
38-
<img src="https://img.shields.io/discord/743783969216135198?labelColor=56595b&color=ababff&logo=discord&logoColor=ffffff&label=discord&style=for-the-badge"/>
39-
</a>
40-
</p>
41-
42-
43-
## Telegram
44-
45-
📰 Follow the Telegram channel to get the latest news and don't miss the events!
46-
47-
<p align="center">
48-
<a href="https://t.me/deltaicons">
49-
<img src="https://img.shields.io/badge/updates-delta?style=for-the-badge&logo=telegram&logoColor=ffffff&label=Telegram&labelColor=56595b&color=9abeff"/>
50-
</a>
51-
</p>
52-
53-
1+
<p align="center">
2+
<img width="200" src="./images/header.svg"/>
3+
</p>
4+
5+
<h2 align="center" padding="100">Delta Icons for Android</h2>
6+
7+
<p align="center">
8+
<a href="../../../releases/latest">
9+
<img src="https://img.shields.io/github/v/release/Delta-Icons/android?labelColor=56595b&color=a6c6ff&logo=github&logoColor=ffffff&label=release&style=for-the-badge"/>
10+
</a>
11+
12+
<a href="../../../releases">
13+
<img src="https://img.shields.io/github/v/release/Delta-Icons/android?labelColor=56595b&color=f8c28d&logo=github&logoColor=ffffff&include_prereleases&label=beta&style=for-the-badge"/>
14+
</a>
15+
16+
<a href="https://play.google.com/store/apps/details?id=website.leifs.delta">
17+
<img src="https://img.shields.io/static/v1?labelColor=56595b&color=97db99&logo=google-play&logoColor=ffffff&label=google play&style=for-the-badge&message=get"/>
18+
</a>
19+
20+
<a href="https://f-droid.org/packages/website.leifs.delta.foss">
21+
<img src="https://img.shields.io/static/v1?labelColor=56595b&color=f9de81&logo=f-droid&logoColor=ffffff&label=f-droid&style=for-the-badge&message=get"/>
22+
</a>
23+
</p>
24+
25+
## Contributing
26+
27+
Please refer to **[contribution guidelines](./CONTRIBUTING.md)**.
28+
29+
30+
## Discord
31+
32+
✋ The server is **not** intended for requests!
33+
34+
👋 If you need help contributing or just want to chat with other contributors feel free to **[join us](https://discord.gg/F9RFqHN)**!
35+
36+
<p align="center">
37+
<a href="https://discord.gg/F9RFqHN">
38+
<img src="https://img.shields.io/discord/743783969216135198?labelColor=56595b&color=ababff&logo=discord&logoColor=ffffff&label=discord&style=for-the-badge"/>
39+
</a>
40+
</p>
41+
42+
43+
## Telegram
44+
45+
📰 Follow the Telegram channel to get the latest news and don't miss the events!
46+
47+
<p align="center">
48+
<a href="https://t.me/deltaicons">
49+
<img src="https://img.shields.io/badge/updates-delta?style=for-the-badge&logo=telegram&logoColor=ffffff&label=Telegram&labelColor=56595b&color=9abeff"/>
50+
</a>
51+
</p>
File renamed without changes.

resources/utilities/add_icons.py .github/scripts/add_icons.py

+37-40
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from subprocess import check_output as get_output
1414
from sys import argv as args
1515

16+
import requests_parser
17+
from resolve_paths import paths
1618

1719
parser = argparse.ArgumentParser()
1820
parser.add_argument('-n', '--name', metavar='NAME', help='the name of a drawable entry')
@@ -53,27 +55,25 @@
5355
name = options.name
5456
path = options.path
5557

56-
5758
if path: delta_dir = abspath(path)
5859
else: delta_dir = dirname(realpath(__file__ + '/../..')) # if the script placed in utility_scripts
5960

60-
work_dir = dirname(realpath(__file__))
61-
icons_dir = abspath(f'{work_dir}/icons')
62-
63-
64-
appfilter_files = [ abspath(f'{delta_dir}/app/src/main/res/xml/appfilter.xml'),
65-
abspath(f'{delta_dir}/app/src/main/assets/appfilter.xml')]
66-
drawable_files = [ abspath(f'{delta_dir}/app/src/main/res/xml/drawable.xml'),
67-
abspath(f'{delta_dir}/app/src/main/assets/drawable.xml')]
68-
icons_src_files = [ abspath(f'{icons_dir}/{name}.png'),
69-
abspath(f'{icons_dir}/{name}.svg')]
70-
icons_dst_files = [ abspath(f'{delta_dir}/app/src/main/res/drawable-nodpi/{name}.png'),
71-
abspath(f'{delta_dir}/resources/vectors/{name}.svg')]
72-
requests_file = abspath(f'{delta_dir}/resources/requests.txt')
61+
work_dir = paths['scripts']
62+
icons_dir = paths['src']['dir']
63+
appfilter_files = paths['appfilter']
64+
drawable_files = paths['drawable']
65+
requests_file = paths['requests']
66+
icons_src_files = [
67+
paths['src']['png'].format(name),
68+
paths['src']['svg'].format(name)
69+
]
70+
icons_dst_files = [
71+
paths['dst']['png'].format(name),
72+
paths['dst']['svg'].format(name)
73+
]
7374

7475
git_arguments = appfilter_files + drawable_files + [requests_file]
7576

76-
7777
blank = ''
7878
changes = False
7979
dry_run_prefix = 'will be ' if dry_run else blank
@@ -263,34 +263,31 @@ def verb(text=False, code=0):
263263

264264

265265
if include_requests:
266-
filename = 'requests.txt'
266+
filename = 'requests.yml'
267267
if not compinfos: out.warn(f'{filename}: no compinfos passed')
268268
else:
269-
with open(requests_file, 'r+', encoding='utf-8', newline=blank) as file:
270-
content = file.read()
271-
lines = []
272-
lines_count = 0
273-
for compinfo in compinfos:
274-
try:
275-
pattern = fr'\n.*\n.*{re.escape(compinfo)}.*\n.*\nRequested.*\n.*\n\t'
276-
match = re.search(pattern, content)
277-
lines.append(re.findall(pattern, content)[0].splitlines()[1:6])
278-
if match:
279-
content = re.sub(pattern, blank, content)
280-
lines_count += 1
281-
except: continue
282-
if lines_count > 0:
283-
write(file, content)
284-
entry = 'entry' if lines_count == 1 else 'entries'
285-
out.done(f'{filename}: {dry_run_prefix + "removed"} {lines_count} {entry}')
286-
if verbose:
269+
requests = requests_parser.read(requests_file)
270+
lines = []
271+
for compinfo in compinfos:
272+
if compinfo in requests:
273+
lines.append(compinfo)
274+
requests.pop(compinfo)
275+
276+
lines_count = len(lines)
277+
278+
if not dry_run: requests_parser.write(requests_file, requests)
279+
280+
if lines_count > 0:
281+
entry = 'entry' if lines_count == 1 else 'entries'
282+
out.done(f'{filename}: {dry_run_prefix + "removed"} {lines_count} {entry}')
283+
if verbose:
284+
out.verb()
285+
for group in lines:
286+
for entry in group: out.verb(out.rem.format(entry))
287287
out.verb()
288-
for group in lines:
289-
for entry in group: out.verb(out.rem.format(entry))
290-
out.verb()
291-
changes = True
292-
else:
293-
out.warn(f'{filename}: no entries found to delete')
288+
changes = True
289+
else:
290+
out.warn(f'{filename}: no entries found to delete')
294291

295292

296293
try:

resources/utilities/add_icons_wrapper.py .github/scripts/add_icons_wrapper.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
from os import name as platform
55
from os.path import abspath, basename, dirname, realpath
66

7+
from natsort import natsorted as sorted
78
from yaml import safe_load as yaml
89

9-
from natsort import natsorted as sorted
10+
from resolve_paths import paths
1011

1112

12-
work_dir = dirname(realpath(__file__))
13-
delta_dir = abspath(f'{work_dir}/../..')
14-
target_file = abspath(f'{work_dir}/../new_icons.yaml')
15-
target_script = abspath(f'{work_dir}/add_icons.py')
13+
work_dir = paths['scripts']
14+
delta_dir = paths['root']
15+
target_file = paths['icons']
16+
target_script = work_dir + '/add_icons.py'
1617

1718
null = '>NUL 2>NUL' if platform == 'nt' else '>/dev/null 2>&1'
1819

@@ -49,6 +50,7 @@
4950
if status != 0:
5051
print(f'> {drawable}:')
5152
execute(f'{command} -D')
53+
print(command)
5254
print()
5355
errors.append(drawable)
5456

.github/scripts/bump_version.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse, re
4+
5+
from resolve_paths import paths
6+
7+
8+
argparser = argparse.ArgumentParser(description='Bump release version')
9+
argparser.add_argument('-t', dest='type',
10+
help='type of release [beta|prod]',
11+
default='beta')
12+
args = argparser.parse_args()
13+
14+
15+
target = paths['root'] + '/app/build.gradle'
16+
17+
regexp_version_code = re.compile('versionCode (\d+)')
18+
regexp_version_name = re.compile('versionName "((\d+\.\d+\.\d+)(-beta(\d+))?)"')
19+
is_beta = 'true' if args.type == 'beta' else 'false'
20+
21+
with open(target, 'r+') as file:
22+
23+
content = file.read()
24+
latest_version = re.search(regexp_version_name, content)
25+
26+
full_version = latest_version.group(1)
27+
base_version = latest_version.group(2)
28+
beta_version = str(int(latest_version.group(4) if latest_version.group(4) else '-1') + 1)
29+
build_number = str(int(re.search(regexp_version_code, content).group(1)[-3:]) + 1)
30+
31+
if args.type == 'prod':
32+
if not 'beta' in full_version:
33+
base_version = list(map(int, base_version.split('.')))
34+
base_version[2] += 1
35+
for n in range(2):
36+
if base_version[2-n] > 9:
37+
base_version[2-n] = 0
38+
base_version[1-n] += 1
39+
new_version = '.'.join(str(x) for x in base_version)
40+
build_number = '0'
41+
else:
42+
new_version = base_version
43+
version_code = new_version.replace('.', '') + build_number.rjust(3, '0')
44+
version_name = new_version
45+
else:
46+
base_version = list(map(int, base_version.split('.')))
47+
if not 'beta' in full_version:
48+
build_number = '0'
49+
base_version[2] += 1
50+
for n in range(2):
51+
if base_version[2-n] > 9:
52+
base_version[2-n] = 0
53+
base_version[1-n] += 1
54+
new_version = '.'.join(str(x) for x in base_version)
55+
version_code = new_version.replace('.', '') + build_number.rjust(3, '0')
56+
version_name = new_version + '-beta' + beta_version
57+
58+
content = re.sub(regexp_version_code, f'versionCode {version_code}', content)
59+
content = re.sub(regexp_version_name, f'versionName "{version_name}"', content)
60+
61+
file.seek(0)
62+
file.write(content)
63+
file.truncate()
64+
65+
print(f'is_beta={is_beta}')
66+
print(f'filename=delta-v{version_name}')
67+
print(f'version=v{version_name}')
68+
print(f'version_code={version_code}')
69+
print(f'version_name={version_name}')

0 commit comments

Comments
 (0)