ci: create repo index.html lising apk (#3016)

* ci: create repo `index.html` lising apk

I'd like to use https://github.com/ImranR98/Obtainium to track and install these extensions. For this all we need is a directory listing rendered in html index with links to the apk files.

Unfortunately the directory listing on [github](https://github.com/keiyoushi/extensions/tree/repo/apk/) and [jsdelivr](https://cdn.jsdelivr.net/gh/keiyoushi/extensions@repo/apk/) cause errors because of the large number of apk files.

The proposed change creates a listing of the apk files at `index.html` in ci.

* ci: Invalidate index.html JSDelivr cache when pushing to repo

* Revert invalidating index.html JSDelivr cache

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>

* ci: Use apk name in index.html

---------

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
aaronisles 2024-05-18 00:11:46 +12:00 committed by GitHub
parent 7ef6508210
commit 33f354e73a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,4 @@
import html
import json
import os
import re
@ -106,3 +107,11 @@ with (REPO_DIR / "index.json").open("w", encoding="utf-8") as f:
with (REPO_DIR / "index.min.json").open("w", encoding="utf-8") as f:
json.dump(index_min_data, f, ensure_ascii=False, separators=(",", ":"))
with (REPO_DIR / "index.html").open("w", encoding="utf-8") as f:
f.write('<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<title>apks</title>\n</head>\n<body>\n<pre>\n')
for entry in index_data:
apk_escaped = 'apk/' + html.escape(entry["apk"])
name_escaped = html.escape(entry["name"])
f.write(f'<a href="{apk_escaped}">{name_escaped}</a>\n')
f.write('</pre>\n</body>\n</html>\n')