From 1b44128766f1a197b6b603d82d5bc95a76949790 Mon Sep 17 00:00:00 2001 From: Dany Date: Fri, 4 Aug 2023 22:36:34 +0200 Subject: [PATCH] added tag --- .github/workflows/main.yml | 20 +++++++++++++------- my_plugin/my_plugin.py | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6fc176a..04f4187 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,9 @@ on: tags: - "v*.*.*" +env: + PLUGIN_JSON: "0.0.1" + jobs: test: @@ -29,12 +32,15 @@ jobs: run: | python -m pip install --upgrade pip if [ -f my_plugin/requirements.txt ]; then pip install -r my_plugin/requirements.txt; fi - - name: Publish GitHub release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get version + run: | + echo 'PLUGIN_JSON<> $GITHUB_ENV + cat ./my_plugin/plugin.json >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - name: Publish tag + uses: rickstaa/action-create-tag@v1 with: - tag_name: ${{ github.ref }} - draft: false - prerelease: false + tag: "${{fromJson(env.PLUGIN_JSON).version}}" + tag_exists_error: false + message: "Latest release" diff --git a/my_plugin/my_plugin.py b/my_plugin/my_plugin.py index 4208fd6..2d4ef5b 100644 --- a/my_plugin/my_plugin.py +++ b/my_plugin/my_plugin.py @@ -1,5 +1,18 @@ from cat.mad_hatter.decorators import tool, hook -from datetime import datetime +from pydantic import BaseModel +from datetime import datetime, date + +class MySettings(BaseModel): + required_int: int + optional_int: int = 42 + required_str: str + optional_str: str = "stocats" + required_date: date + optional_date: date = 1679616000 + +@hook +def plugin_settings_schema(): + return MySettings.schema() @tool def get_the_time(tool_input, cat):