25 lines
648 B
YAML
25 lines
648 B
YAML
name: Deploy via Portainer
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Trigger Portainer stack redeploy
|
|
run: |
|
|
python3 -c "
|
|
import urllib.request, sys
|
|
url = '${{ secrets.PORTAINER_WEBHOOK }}'
|
|
req = urllib.request.Request(url, method='POST')
|
|
try:
|
|
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)
|
|
"
|