File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ name: Deploy VulnBank
22
33on :
44 push :
5- branches : [ main ]
5+ branches :
6+ - main
67 workflow_dispatch :
78
89jobs :
2627 - name : Sync code to server
2728 run : |
2829 rsync -avz --delete \
30+ --exclude '.env' \
2931 -e "ssh -o StrictHostKeyChecking=no" \
3032 ./ \
3133 ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/home/${{ secrets.USERNAME }}/vuln-bank/
@@ -38,13 +40,18 @@ jobs:
3840
3941 cd /home/${USER}/vuln-bank
4042
41- # stop containers
43+ # ensure .env exists (bootstrap on first deploy)
44+ if [ ! -f .env ]; then
45+ cp .example.env .env
46+ fi
47+
48+ # stop any running containers
4249 docker compose down
4350
4451 # rebuild & restart
4552 docker compose up -d --build
4653
47- # cleanup old images
54+ # remove dangling images
4855 docker image prune -f
4956
5057 # show status
You can’t perform that action at this time.
0 commit comments