diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..42cfe02 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,78 @@ +name: Release + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + permissions: write-all + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Extract version from commit message + id: ver + run: | + COMMIT_MESSAGE=$(git log -1 --pretty=%B) + echo "Commit message: $COMMIT_MESSAGE" + if [[ $COMMIT_MESSAGE =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "version=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT + else + echo "exit no version x.x.x in the commit message" + exit 1 + fi + # Remove existing data.json file + - name: Remove data.json + run: rm -f data.json + + # Get a list of all the files in the prompts folder + - name: Get list of prompts + run: ls prompts > prompts.txt + + # Remove the file extension from each file name + - name: Remove file extensions + run: sed -i 's/\..*$//' prompts.txt + + - name: Create data.json + run: | + # Add double quotes around each line + sed -i 's/^/"/' prompts.txt + sed -i 's/$/"/' prompts.txt + + # Add comma at the end of each line except the last one + sed -i '$!s/$/,/' prompts.txt + # Create the JSON file + echo "{\"prompts\": [$(cat prompts.txt)]}" > data.json + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.ver.outputs.version }} + release_name: ${{ steps.ver.outputs.version }} + draft: false + prerelease: false + - name: Attach data.json + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: data.json + asset_name: data.json + asset_content_type: application/json + - name: Attach manifest.json + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: manifest.json + asset_name: manifest.json + asset_content_type: application/json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..878573b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 nhaouari + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b2337e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Template's Package Template +This is a template repo to facilitate the creation of new template packages for Text generator Plugin. +# [How to create Templates package](https://text-gen.com/share-a-new-template-package) diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..53f4839 --- /dev/null +++ b/manifest.json @@ -0,0 +1,11 @@ +{ + "packageId": "Put_Package_Id_Here", + "name": "Name of your package", + "version": "0.0.1", + "minTextGeneratorVersion": "0.1.0", + "description": "The description of the content of this package", + "author": "Your name", + "tags": "writing, brainstorming", + "authorUrl": "Support URL", + "repo": "username/repo" +} diff --git a/prompts/getExample.md b/prompts/getExample.md new file mode 100644 index 0000000..adbf70c --- /dev/null +++ b/prompts/getExample.md @@ -0,0 +1,14 @@ +--- +promptId: getExample +name: ✉️ Emoji + Short description +description: longer description +author: author Name +tags: tag1, tag2 +required_values: val1, val2 +version: 0.0.1 +--- +content: +{{context}} +prompt: +Write an example about content +example: