From f8c76aeba77591491d4724828d4b97f8af5c81f3 Mon Sep 17 00:00:00 2001 From: Mgldvd Date: Sun, 26 Feb 2023 18:55:53 -0500 Subject: [PATCH] Add new action to generate themes --- .github/workflows/actions.yml | 60 +++++++++++++++++++++++++++-------- requirements.txt | 3 +- tools/generatJson.py | 4 +-- tools/generateShFiles.py | 4 +-- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index eb18704..a410ad4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,18 +1,52 @@ -name: Generate themes.json -on: [workflow_dispatch] +name: Execute Python Scripts on New Theme-YML Files + +on: + push: + paths: + - 'theme-yml/*' jobs: - run: - name: Lint with ESLint - runs-on: ubuntu-latest + build: + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - run: | - bash tools/generate.sh - git config user.name github-actions[bot] - git config user.email github-actions[bot]@github.com - git add . - git commit -m "------- Generate themes.json -------" - git push + - name: Checkout code + uses: actions/checkout@v2 + - name: Update ubuntu + run: | + apt -qq update + echo 🏅 + + - name: Install python3 + run: | + apt install python3 -y > /dev/null 2>&1 + echo 🏅 + + - name: Install pip3 + run: | + apt install -y python3-pip > /dev/null 2>&1 + echo 🏅 + + - name: Python3 requirements.txt + run: | + pip3 install -r requirements.txt > /dev/null 2>&1 + echo 🏅 + + - name: Generate json + run: | + python3 tools/generatJson.py + echo 🏅 + + - name: Generate Installers + run: | + python3 tools/generateShFiles.py + echo 🏅 + + - name: Git commit + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@github.com + git add . + git commit -m "------- Generate Themes Github Action -------" + git push \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7843954..dfd46d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ ruamel.yaml==0.17.21 - +unidecode +pyyaml diff --git a/tools/generatJson.py b/tools/generatJson.py index 8e63448..1f6d029 100644 --- a/tools/generatJson.py +++ b/tools/generatJson.py @@ -3,8 +3,8 @@ import json import yaml import hashlib -source_path = "../themes-yml" -dest_path = "../data/themes.json" +source_path = "./themes-yml" +dest_path = "./data/themes.json" themes = [] os.remove(dest_path) diff --git a/tools/generateShFiles.py b/tools/generateShFiles.py index c9b3901..a7dd92d 100644 --- a/tools/generateShFiles.py +++ b/tools/generateShFiles.py @@ -5,8 +5,8 @@ import re import subprocess import yaml -folder_path = "../themes-yml" -dest_path = '../themes' +folder_path = "./themes-yml" +dest_path = './themes' themes = [] # List files and directories in the folder