add gitea action
Some checks failed
Portainer Stack Update / update_stack (push) Failing after 42s

This commit is contained in:
krisz 2025-04-21 17:34:30 +02:00
parent 4560cddeec
commit 871d35a5a7
5 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,40 @@
name: Portainer Stack Update
on:
push:
branches:
- main
jobs:
update_stack:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Detect changed compose files
id: changed
run: |
# Get only changed docker-compose.yml files in top-level folders
CHANGED_COMPOSE_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '^[^/]+/docker-compose\.yml$' | cut -d '/' -f1 | sort -u)
echo "CHANGED_COMPOSE_DIRS=$CHANGED_COMPOSE_DIRS" >> $GITHUB_ENV
- name: Update relevant stacks in Portainer
run: |
echo "Reading stack mapping..."
STACK_MAP=$(cat .stack-map.json)
for dir in $CHANGED_COMPOSE_DIRS; do
echo "Checking directory: $dir"
STACK_ID=$(echo "$STACK_MAP" | jq -r --arg d "$dir" '.[$d]')
if [ "$STACK_ID" != "null" ]; then
echo "Updating Portainer stack $dir (ID: $STACK_ID)..."
curl -X POST "https://portainer.szabolcsi.dev/api/stacks/webhooks/$STACK_ID"
else
echo "No stack ID found for $dir, skipping."
fi
done
env:
CHANGED_COMPOSE_DIRS: ${{ env.CHANGED_COMPOSE_DIRS }}

3
.stack-map.json Normal file
View File

@ -0,0 +1,3 @@
{
"services": "c4051c28-2975-44a6-aa86-13717e5fe10f"
}

View File

@ -1 +1,3 @@
GITEA_DB_PASSWORD=
HAPROXY_CONFIG_NAME=
GITEA_RUNNER_TOKEN=

View File

@ -0,0 +1,32 @@
global
log /dev/log local0
log /dev/log local1 notice
user root
group root
daemon
defaults
log global
mode tcp
option tcplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
listen database
bind *:3306
server database database_mariadb:3306
frontend http
bind *:80
mode http
acl is_portainer hdr_dom(host) -i portainer.szabolcsi.dev
use_backend portainer_backend if is_portainer
http-request deny
backend portainer_backend
mode http
server portainer portainer_portainer:9000

View File

@ -98,9 +98,13 @@ services:
local:
aliases:
- database
- portainer.szabolcsi.dev
database:
aliases:
- services-proxy
portainer:
aliases:
- service-proxy
configs:
- source: haproxy
target: /usr/local/etc/haproxy/haproxy.cfg
@ -122,6 +126,8 @@ networks:
external: true
database:
external: true
portainer:
external: true
volumes:
gitea: