From 1402638ca7e8970e60b0da351ffd074b11a7d569 Mon Sep 17 00:00:00 2001 From: ThaMunsta Date: Fri, 14 Mar 2025 15:53:10 -0400 Subject: [PATCH] hold on to yo butts --- .gitea/workflows/demo.yaml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 34d5e7b..1e3e77f 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -7,15 +7,22 @@ jobs: runs-on: synology steps: - run: docker pull linuxserver/bookstack - - run: docker stack deploy bookstack - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository + - name: Fetch stack ID from Portainer run: | - ls ${{ gitea.workspace }} + STACK_NAME="bookstack" + PORTAINER_API_URL="https://portainer.dev.nervesocket.com/api" + PORTAINER_TOKEN="ptr_WnwQZKLIEcYMc4see6SyBgiSL7dzpnzCyi4CTCP" + + STACK_ID=$(curl -s -H "X-API-Key: $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks" | jq -r ".[] | select(.Name==\"$STACK_NAME\") | .Id") + echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV + + - name: Trigger stack update in Portainer + run: | + PORTAINER_API_URL="https://portainer.dev.nervesocket.com/api" + PORTAINER_TOKEN="ptr_WnwQZKLIEcYMc4see6SyBgiSL7dzpnzCyi4CTCP" + + curl -X POST "$PORTAINER_API_URL/stacks/$STACK_ID/redeploy" \ + -H "X-API-Key: $PORTAINER_TOKEN" \ + -H "Content-Type: application/json" \ + --data '{"pullImage": true}' - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file