mirror of
https://github.com/zen-browser/theme-store.git
synced 2025-07-07 17:05:31 +02:00
chore: Update create-theme workflow to output styles and readme
This commit is contained in:
parent
22681c76e1
commit
f7711c3b57
2 changed files with 30 additions and 13 deletions
15
.github/workflows/create-theme.yml
vendored
15
.github/workflows/create-theme.yml
vendored
|
@ -31,8 +31,15 @@ jobs:
|
||||||
echo "THEME_NAME=${{ fromJson(steps.issue-parser.outputs.jsonString)['name'] }}" >> $GITHUB_ENV
|
echo "THEME_NAME=${{ fromJson(steps.issue-parser.outputs.jsonString)['name'] }}" >> $GITHUB_ENV
|
||||||
echo "THEME_DESCRIPTION=${{ fromJson(steps.issue-parser.outputs.jsonString)['description'] }}" >> $GITHUB_ENV
|
echo "THEME_DESCRIPTION=${{ fromJson(steps.issue-parser.outputs.jsonString)['description'] }}" >> $GITHUB_ENV
|
||||||
echo "THEME_HOMEPAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['homepage'] }}" >> $GITHUB_ENV
|
echo "THEME_HOMEPAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['homepage'] }}" >> $GITHUB_ENV
|
||||||
echo 'THEME_STYLES=${{ fromJson(steps.issue-parser.outputs.jsonString)['styles'] }}' >> $GITHUB_ENV
|
|
||||||
echo 'THEME_README=${{ fromJson(steps.issue-parser.outputs.jsonString)['readme'] }}' >> $GITHUB_ENV
|
echo "Ouputing styles and readme"
|
||||||
|
cat <<THEME_CREATE_EOT >> theme-styles.css
|
||||||
|
${{ fromJson(steps.issue-parser.outputs.jsonString)['styles'] }}
|
||||||
|
THEME_CREATE_EOT
|
||||||
|
|
||||||
|
cat <<THEME_CREATE_EOT >> theme-readme.md
|
||||||
|
${{ fromJson(steps.issue-parser.outputs.jsonString)['readme'] }}
|
||||||
|
THEME_CREATE_EOT
|
||||||
|
|
||||||
- name: Setup Git
|
- name: Setup Git
|
||||||
run: |
|
run: |
|
||||||
|
@ -44,9 +51,7 @@ jobs:
|
||||||
python3 scripts/submit-theme.py \
|
python3 scripts/submit-theme.py \
|
||||||
--name "${{ env.THEME_NAME }}" \
|
--name "${{ env.THEME_NAME }}" \
|
||||||
--description "${{ env.THEME_DESCRIPTION }}" \
|
--description "${{ env.THEME_DESCRIPTION }}" \
|
||||||
--homepage "${{ env.THEME_HOMEPAGE }}" \
|
--homepage "${{ env.THEME_HOMEPAGE }}" 2> error.log
|
||||||
--styles "${{ env.THEME_STYLES }}" \
|
|
||||||
--readme "${{ env.THEME_README }}" 2> error.log
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Export creation output
|
- name: Export creation output
|
||||||
|
|
|
@ -7,27 +7,40 @@ import uuid
|
||||||
STYLES_FILE = "chrome.css"
|
STYLES_FILE = "chrome.css"
|
||||||
README_FILE = "readme.md"
|
README_FILE = "readme.md"
|
||||||
|
|
||||||
|
TEMPLATE_STYLES_FILE = "./theme-styles.css"
|
||||||
|
TEMPLATE_README_FILE = "./theme-readme.md"
|
||||||
|
|
||||||
def create_theme_id():
|
def create_theme_id():
|
||||||
return str(uuid.uuid4())
|
return str(uuid.uuid4())
|
||||||
|
|
||||||
def get_static_asset(theme_id, asset):
|
def get_static_asset(theme_id, asset):
|
||||||
return f"https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/{theme_id}/{asset}"
|
return f"https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/{theme_id}/{asset}"
|
||||||
|
|
||||||
|
def get_styles():
|
||||||
|
with open(TEMPLATE_STYLES_FILE, 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
content = content[len("```css"):]
|
||||||
|
content = content[:-len("```")]
|
||||||
|
return content
|
||||||
|
|
||||||
|
def get_readme():
|
||||||
|
with open(TEMPLATE_README_FILE, 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
content = content[len("```markdown"):]
|
||||||
|
content = content[:-len("```")]
|
||||||
|
return content
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Submit a theme to the theme repo.')
|
parser = argparse.ArgumentParser(description='Submit a theme to the theme repo.')
|
||||||
parser.add_argument('--name', type=str, help='The theme to submit.')
|
parser.add_argument('--name', type=str, help='The theme to submit.')
|
||||||
parser.add_argument('--description', type=str, help='The description of the theme.')
|
parser.add_argument('--description', type=str, help='The description of the theme.')
|
||||||
parser.add_argument('--homepage', type=str, help='The homepage of the theme.')
|
parser.add_argument('--homepage', type=str, help='The homepage of the theme.')
|
||||||
parser.add_argument('--styles', type=str, help='The style of the theme.')
|
|
||||||
parser.add_argument('--readme', type=str, help='The README of the theme.')
|
|
||||||
parser.add_argument('--author', type=str, help='The author of the theme.')
|
parser.add_argument('--author', type=str, help='The author of the theme.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
name = args.name
|
name = args.name
|
||||||
description = args.description
|
description = args.description
|
||||||
homepage = args.homepage
|
homepage = args.homepage
|
||||||
style = args.styles
|
|
||||||
readme = args.readme
|
|
||||||
author = args.author
|
author = args.author
|
||||||
|
|
||||||
theme_id = create_theme_id()
|
theme_id = create_theme_id()
|
||||||
|
@ -36,9 +49,8 @@ def main():
|
||||||
Welcome to the Zen Browser Theme Store!
|
Welcome to the Zen Browser Theme Store!
|
||||||
|
|
||||||
Please review the information below before submitting your theme. Also... Why are you here?
|
Please review the information below before submitting your theme. Also... Why are you here?
|
||||||
|
|
||||||
This action is only for theme reviewers. If you are a theme developer, please use the theme store.
|
This action is only for theme reviewers. If you are a theme developer, please use the theme store.
|
||||||
|
|
||||||
Just joking, you can do whatever you want. You're the boss.
|
Just joking, you can do whatever you want. You're the boss.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
@ -57,10 +69,10 @@ Just joking, you can do whatever you want. You're the boss.
|
||||||
json.dump(theme, f)
|
json.dump(theme, f)
|
||||||
|
|
||||||
with open(f"themes/{theme_id}/{STYLES_FILE}", 'w') as f:
|
with open(f"themes/{theme_id}/{STYLES_FILE}", 'w') as f:
|
||||||
f.write(style)
|
f.write(get_styles())
|
||||||
|
|
||||||
with open(f"themes/{theme_id}/{README_FILE}", 'w') as f:
|
with open(f"themes/{theme_id}/{README_FILE}", 'w') as f:
|
||||||
f.write(readme)
|
f.write(get_readme())
|
||||||
|
|
||||||
print(f"Theme submitted with ID: {theme_id}")
|
print(f"Theme submitted with ID: {theme_id}")
|
||||||
for key, value in theme.items():
|
for key, value in theme.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue