mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-06-28 23:40:21 +08:00
fix: remove lfs usage of tree.xml and revert to biggest possible version
Sadly we can no longer update this file as it reached 100MB and that's the max size allowed on GitHub to have files, we could only increase it further by paying for the bandwidth
This commit is contained in:
parent
29f5b05820
commit
d78286a76a
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1 +0,0 @@
|
|||||||
tree.xml filter=lfs diff=lfs merge=lfs -text
|
|
@ -28,12 +28,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
# lfs is needed as tree.xml has size > 100mb
|
|
||||||
run: |
|
run: |
|
||||||
pip install cairosvg pillow requests
|
pip install cairosvg pillow requests
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y zopfli webp
|
sudo apt-get install -y zopfli webp
|
||||||
git lfs install
|
|
||||||
- name: Parse issue form
|
- name: Parse issue form
|
||||||
id: parse_issue_form
|
id: parse_issue_form
|
||||||
run: echo "ISSUE_FORM=$(python scripts/parse_issue_form.py)" >> "$GITHUB_OUTPUT"
|
run: echo "ISSUE_FORM=$(python scripts/parse_issue_form.py)" >> "$GITHUB_OUTPUT"
|
||||||
|
@ -28,12 +28,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
# lfs is needed as tree.xml has size > 100mb
|
|
||||||
run: |
|
run: |
|
||||||
pip install cairosvg pillow requests
|
pip install cairosvg pillow requests
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y zopfli webp
|
sudo apt-get install -y zopfli webp
|
||||||
git lfs install
|
|
||||||
- name: Parse issue form
|
- name: Parse issue form
|
||||||
id: parse_issue_form
|
id: parse_issue_form
|
||||||
run: echo "ISSUE_FORM=$(python scripts/parse_issue_form.py)" >> "$GITHUB_OUTPUT"
|
run: echo "ISSUE_FORM=$(python scripts/parse_issue_form.py)" >> "$GITHUB_OUTPUT"
|
||||||
|
@ -56,7 +56,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config --global user.email "homarr-labs@proton.me"
|
git config --global user.email "homarr-labs@proton.me"
|
||||||
git config --global user.name "Dashboard Icons Bot"
|
git config --global user.name "Dashboard Icons Bot"
|
||||||
git add tree.json tree.xml
|
git add tree.json
|
||||||
git commit -m "ci(github-actions): generate file tree" || exit 0
|
git commit -m "ci(github-actions): generate file tree" || exit 0
|
||||||
git pull --rebase origin ${{ github.ref_name }}
|
git pull --rebase origin ${{ github.ref_name }}
|
||||||
git push origin HEAD:${{ github.ref_name }}
|
git push origin HEAD:${{ github.ref_name }}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import os
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import base64
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
|
||||||
|
|
||||||
def generate_folder_tree(paths):
|
def generate_folder_tree(paths):
|
||||||
tree = {}
|
tree = {}
|
||||||
@ -22,31 +21,6 @@ def generate_folder_tree(paths):
|
|||||||
webp_files.append(os.path.join(root, file))
|
webp_files.append(os.path.join(root, file))
|
||||||
return tree, webp_files
|
return tree, webp_files
|
||||||
|
|
||||||
def generate_webp_xml(webp_files):
|
|
||||||
json_obj_list = []
|
|
||||||
for path in webp_files:
|
|
||||||
with open(path, "rb") as image_file:
|
|
||||||
# Encode the WebP image to base64
|
|
||||||
data = base64.b64encode(image_file.read()).decode('ascii')
|
|
||||||
|
|
||||||
# Build the base64 string for data URI
|
|
||||||
data_string = f"data:image/webp;base64,{data}"
|
|
||||||
|
|
||||||
# Extract name from the path
|
|
||||||
name = Path(path).stem
|
|
||||||
|
|
||||||
# Append the base64 encoded WebP data into the list
|
|
||||||
json_obj_list.append({
|
|
||||||
"data": data_string,
|
|
||||||
"w": 48,
|
|
||||||
"h": 48,
|
|
||||||
"title": name,
|
|
||||||
"aspect": "fixed"
|
|
||||||
})
|
|
||||||
|
|
||||||
# Convert to JSON string with no extra spaces for XML output
|
|
||||||
return json.dumps(json_obj_list, separators=(',', ':'))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Adjust paths to be one level up
|
# Adjust paths to be one level up
|
||||||
folder_paths = sys.argv[1:]
|
folder_paths = sys.argv[1:]
|
||||||
@ -64,16 +38,4 @@ if __name__ == "__main__":
|
|||||||
tree_json_path = root_dir.parent / 'tree.json'
|
tree_json_path = root_dir.parent / 'tree.json'
|
||||||
with open(tree_json_path, 'w') as f:
|
with open(tree_json_path, 'w') as f:
|
||||||
json.dump(folder_tree, f, indent=4, sort_keys=True) # Sort the keys in the JSON output
|
json.dump(folder_tree, f, indent=4, sort_keys=True) # Sort the keys in the JSON output
|
||||||
print(f"Folder tree successfully written to '{tree_json_path}'.")
|
print(f"Folder tree successfully written to '{tree_json_path}'.")
|
||||||
|
|
||||||
# Generate WebP XML
|
|
||||||
if webp_files:
|
|
||||||
webp_json = generate_webp_xml(webp_files)
|
|
||||||
|
|
||||||
# Write XML structure (with wrapped JSON) to 'tree.xml'
|
|
||||||
xml_output_path = root_dir.parent / 'tree.xml'
|
|
||||||
with open(xml_output_path, 'w') as xml_output:
|
|
||||||
print(f"<mxlibrary>{webp_json}</mxlibrary>", file=xml_output)
|
|
||||||
print(f"WebP assets successfully written to '{xml_output_path}'.")
|
|
||||||
else:
|
|
||||||
print("No WebP files found for XML generation.")
|
|
Loading…
x
Reference in New Issue
Block a user