Skip to content

Commit 99371b8

Browse files
author
Raphaël Bourgouin
committed
Added a reusable workflow to deploy a portainer stack
1 parent af0c0d6 commit 99371b8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/deploy-stack.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: deploy a stack on portainer
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
portainer_stack_webhook:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Connect to vpn (necessary to access portainer)
15+
run: |
16+
sudo apt install resolvconf
17+
sudo apt install wireguard
18+
echo "${{ secrets.WIREGUARD_CONF }}" > wg0.conf
19+
sudo chmod 600 wg0.conf
20+
echo "setting config"
21+
sudo wg-quick up ./wg0.conf
22+
23+
- name: Trigger Portainer stack webhook
24+
run: |
25+
response=$(curl -X POST -w "%{http_code}" -o /dev/null -s ${{ secrets.portainer_stack_webhook }})
26+
if [ "$response" -ne 204 ]; then
27+
echo "Error: POST request failed with status code $response"
28+
exit 1
29+
fi

0 commit comments

Comments
 (0)