Updates lib scripts to use sources, not external

This commit is contained in:
Alicia Sykes
2023-04-16 21:14:01 +01:00
parent 09e8f9b6c0
commit 8c221377d2
6 changed files with 13 additions and 6 deletions

5
.github/README.md vendored
View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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
sources/.gitkeep Normal file
View File

View File

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