From 8910dfa4c0286f24f863f663e8706b95c4b28b34 Mon Sep 17 00:00:00 2001 From: MrZaiko Date: Tue, 8 Apr 2025 11:45:04 +0200 Subject: [PATCH] Update workflow --- .gitea/workflows/deploy.sh | 14 ++++++++++++++ .gitea/workflows/deploy.yml | 9 ++++++++- main.py | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/deploy.sh diff --git a/.gitea/workflows/deploy.sh b/.gitea/workflows/deploy.sh new file mode 100644 index 0000000..3b2bad5 --- /dev/null +++ b/.gitea/workflows/deploy.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +#!/bin/bash + +# Config +PORTAINER_URL="http://192.168.1.17:9000" +API_KEY="${PORTAINER_API_KEY}" # store this securely! +STACK_ID=27 # local_stuff stack + +# Redeploy Stack +curl -s -X POST "$PORTAINER_URL/api/stacks/$STACK_ID/redeploy" \ + -H "X-API-Key: $API_KEY" \ + -H "Content-Type: application/json" \ + -d '{}' diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5494bab..54123bf 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -30,4 +30,11 @@ jobs: context: . file: ./Dockerfile push: true - tags: gitea.abzk.fr/mrzaiko/jarvis:latest \ No newline at end of file + tags: gitea.abzk.fr/mrzaiko/jarvis:latest + + - name: Deploy to Portainer + run: | + curl -s -X POST "http://192.168.1.17:9000/api/stacks/27/redeploy" \ + -H "X-API-Key: ${{ secrets.PORTAINER_API_KEY }}" \ + -H "Content-Type: application/json" \ + -d '{}' diff --git a/main.py b/main.py index 8e00f74..115dc45 100644 --- a/main.py +++ b/main.py @@ -113,6 +113,8 @@ async def handle_menu(update: Update, context: ContextTypes.DEFAULT_TYPE) -> Non # --- Main Function --- def main(): + print("Starting Jarvis...") + # Initiate api kuma_api = kuma.KumaAPI("http://192.168.1.2:36667", "k!PTfyvoIJho9o*gX6F1") torrent_api = torrent.TorrentApi("http://192.168.1.17:8112", "tMHNjrJr7nhjyhJrYsahi4anq2h6LJ")