Skip to content

Commit 67d4336

Browse files
JihoonahnJihoonahn
authored andcommitted
Update github action
1 parent 73ffa32 commit 67d4336

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

.github/workflows/deploy.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Website
1+
name: Deploy
22

33
on:
44
push:
@@ -40,8 +40,43 @@ jobs:
4040
- name: Deploy to GitHub Pages
4141
uses: peaceiris/actions-gh-pages@v4
4242
with:
43-
github_token: ${{ secrets.GITHUB_TOKEN }}
4443
publish_dir: ./dist
4544
publish_branch: gh-pages
4645
cname: jihoon.me
4746
force_orphan: true
47+
48+
crawl:
49+
needs: build-and-deploy
50+
runs-on: ubuntu-latest
51+
if: github.ref == 'refs/heads/main'
52+
53+
steps:
54+
- name: Wait for deployment
55+
run: sleep 30
56+
57+
- name: Verify website is accessible
58+
run: |
59+
curl -f -s -o /dev/null https://jihoon.me || {
60+
echo "Website is not yet accessible, waiting additional 30 seconds..."
61+
sleep 30
62+
}
63+
64+
- name: Trigger DocSearch Crawling
65+
run: |
66+
echo "Triggering DocSearch crawling for updated website..."
67+
response=$(curl -s -w "%{http_code}" -X POST "https://crawler.algolia.com/api/1/crawlers/DOAQK3DEFT/reindex" \
68+
-H "Authorization: Bearer ${{ secrets.DOCSEARCH_API_KEY }}" \
69+
-H "Content-Type: application/json" \
70+
-d '{"force": true}')
71+
72+
http_code="${response: -3}"
73+
if [ "$http_code" -eq 200 ] || [ "$http_code" -eq 201 ]; then
74+
echo "✅ DocSearch crawling triggered successfully"
75+
else
76+
echo "❌ Failed to trigger DocSearch crawling. HTTP code: $http_code"
77+
echo "Response: ${response%???}"
78+
exit 1
79+
fi
80+
81+
- name: Notify completion
82+
run: echo "🎉 DocSearch crawling has been triggered for the updated website. Search index will be updated shortly."

.github/workflows/docsearch.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)