Skip to content

Commit a34741f

Browse files
committed
excluded .env from rsync delete
1 parent ba3557b commit a34741f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Deploy VulnBank
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
workflow_dispatch:
78

89
jobs:
@@ -26,6 +27,7 @@ jobs:
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

0 commit comments

Comments
 (0)