Skip to content

Commit 25bf467

Browse files
committed
feat: stop python http server after use
1 parent 9a7f11f commit 25bf467

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/cron-check-int-links.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,21 @@ jobs:
3737
- name: Install broken-link-checker
3838
run: npm install broken-link-checker
3939

40+
# - name: Start Hugo server
41+
# run: |
42+
# hugo server --quiet --port 1313 >/dev/null 2>&1 &
43+
# until curl -fs http://localhost:1313/ >/dev/null 2>&1; do
44+
# sleep 0.2
45+
# done
46+
# echo "✅ Hugo preview server is ready at http://localhost:1313"
47+
4048
- name: Build Hugo site
4149
run: hugo
4250

4351
- name: Start local server
4452
run: |
4553
python3 -m http.server 1313 --directory public >/dev/null 2>&1 &
54+
echo $! > server.pid
4655
until curl -fs http://localhost:1313 >/dev/null 2>&1; do sleep 0.2; done
4756
echo "✅ Python preview server is ready at http://localhost:1313"
4857
@@ -64,7 +73,15 @@ jobs:
6473
exit 1
6574
fi
6675
67-
- name: Stop Hugo server
76+
# - name: Stop Hugo server
77+
# if: always()
78+
# run: |
79+
# pkill -f "hugo server"
80+
81+
- name: Stop local server
6882
if: always()
6983
run: |
70-
pkill -f "hugo server"
84+
if [ -f server.pid ]; then
85+
kill $(cat server.pid) || true
86+
echo "🛑 Local server stopped"
87+
fi

0 commit comments

Comments
 (0)