This commit is contained in:
@@ -3,6 +3,7 @@ name: Deploy via Portainer
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -10,9 +11,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Trigger Portainer stack redeploy
|
- name: Trigger Portainer stack redeploy
|
||||||
run: |
|
run: |
|
||||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${{ secrets.PORTAINER_WEBHOOK }}")
|
python3 -c "
|
||||||
if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "204" ]; then
|
import urllib.request, sys
|
||||||
echo "Portainer webhook failed (HTTP $HTTP_CODE)"
|
url = '${{ secrets.PORTAINER_WEBHOOK }}'
|
||||||
exit 1
|
req = urllib.request.Request(url, method='POST')
|
||||||
fi
|
try:
|
||||||
echo "Redeploy triggered (HTTP $HTTP_CODE)"
|
resp = urllib.request.urlopen(req)
|
||||||
|
print('Redeploy triggered (HTTP', resp.status, ')')
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
print('Portainer webhook failed (HTTP', e.code, ')')
|
||||||
|
sys.exit(1)
|
||||||
|
"
|
||||||
|
|||||||
Reference in New Issue
Block a user