Parcourir la source

Updates lib scripts to use sources, not external

Alicia Sykes il y a 2 ans
Parent
commit
8c221377d2

+ 4 - 1
.github/README.md

@@ -1,6 +1,9 @@
 
 <h1 align="center">Portainer Templates</h1>
 <p align="center"><i>A compiled list of 400+ ready to go Portainer App templates</i></p>
+<p align="center">
+  <img width="200" src="https://i.ibb.co/hMymwH0/portainer-templates-small.png" />
+</p>
 
 > **TL;DR** Under Settings → App Templates in your Portainer GUI, paste this URL:<br>
 > `https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json`<br>
@@ -54,7 +57,7 @@ Just place a link to the source, along with your chosen name in the [`sources.cs
 When the action runs, it will download the content, parse it and add it to the final template.
 
 ### Adding a Template / Template list
-Alternatively, place your template file within the [`external-templates`](https://github.com/Lissy93/portainer-templates/tree/main/external-templates) directory, and it will be automatically combined into the main `template.json`.
+Alternatively, place your template file within the [`sources`](https://github.com/Lissy93/portainer-templates/tree/main/sources) directory, and it will be automatically combined into the main `template.json`.
 Be sure that your template corresponds to [Portainer's App Template JSON Format](https://docs.portainer.io/advanced/app-templates/format).
 
 ### Validating Templates

+ 1 - 1
.github/workflows/build-template.yml

@@ -37,7 +37,7 @@ jobs:
         run: |
           git config --global user.name "Liss-Bot"
           git config --global user.email "alicia-gh-bot@mail.as93.net"
-          git add .
+          git add templates.json
           if git diff --staged --quiet; then
             echo "Nothin new added, so nothing to commit, exiting..."
             exit 0

+ 3 - 3
lib/combine.py

@@ -1,9 +1,9 @@
 import os
 import json
 
-# Get list of files in external-templates
+# Get list of files in sources
 dir = os.path.dirname(os.path.abspath(__file__))
-templates_src_dir = os.path.join(dir, '../external-templates/')
+templates_src_dir = os.path.join(dir, '../sources/')
 template_dest_file = os.path.join(dir, '../templates.json')
 
 files = os.listdir(templates_src_dir)
@@ -11,7 +11,7 @@ files = os.listdir(templates_src_dir)
 # Initialize empty list to store template objects
 templates = []
 
-# For each file in external-templates
+# For each file in sources
 for file in files:
     # Open the file
     with open(templates_src_dir + file) as f:

+ 1 - 1
lib/download.py

@@ -4,7 +4,7 @@ import requests
 
 dir = os.path.dirname(os.path.abspath(__file__))
 
-destination_dir = os.path.join(dir, '../external-templates')
+destination_dir = os.path.join(dir, '../sources')
 sources_list = os.path.join(dir, '../sources.csv')
 
 # Downloads the file from a given URL, to the local destination

+ 0 - 0
sources/.gitkeep


+ 4 - 0
sources/example_templates.json

@@ -0,0 +1,4 @@
+{
+  "version": "2",
+  "templates": []
+}