Skip to content

Commit 62a46e7

Browse files
authored
Merge pull request #5 from soliplex/docs/add-rebuild-trigger
Docs/add rebuild trigger
2 parents 10fff07 + c83ea7d commit 62a46e7

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Template workflow for submodule repositories
2+
# Copy this file to each submodule's .github/workflows/ directory
3+
#
4+
# Installation instructions:
5+
# 1. Create PAT with 'public_repo' scope at: https://github.com/settings/tokens
6+
# 2. Add secret 'DOCS_DEPLOY_TOKEN' to each submodule repository
7+
# 3. Copy this file to .github/workflows/trigger-docs-deploy.yml in each submodule
8+
# 4. Update the 'paths' section if needed for your project structure
9+
10+
name: Trigger Documentation Rebuild
11+
12+
on:
13+
push:
14+
branches: [main, master] # Adjust branches as needed
15+
paths:
16+
# Trigger only when markdown documentation changes
17+
- 'docs/**/*.md'
18+
- 'docs/**/*.mdx'
19+
- 'README.md'
20+
- '.github/workflows/trigger-docs-deploy.yml'
21+
workflow_dispatch: # Allow manual triggering
22+
23+
jobs:
24+
trigger-docs-rebuild:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Trigger soliplex.github.io documentation rebuild
28+
run: |
29+
echo "📚 Triggering documentation rebuild for ${{ github.repository }}"
30+
31+
# Properly escape JSON using jq
32+
payload=$(jq -n \
33+
--arg repo "${{ github.repository }}" \
34+
--arg ref "${{ github.ref }}" \
35+
--arg sha "${{ github.sha }}" \
36+
--arg pusher "${{ github.actor }}" \
37+
--arg message "${{ github.event.head_commit.message }}" \
38+
'{
39+
event_type: "docs_update",
40+
client_payload: {
41+
repository: $repo,
42+
ref: $ref,
43+
sha: $sha,
44+
pusher: $pusher,
45+
commit_message: $message
46+
}
47+
}')
48+
49+
response=$(curl -X POST \
50+
-H "Accept: application/vnd.github.v3+json" \
51+
-H "Authorization: token ${{ secrets.DOCS_DEPLOY_TOKEN }}" \
52+
-w "\n%{http_code}" \
53+
https://api.github.com/repos/soliplex/soliplex.github.io/dispatches \
54+
-d "$payload")
55+
56+
http_code=$(echo "$response" | tail -n1)
57+
58+
if [ "$http_code" -eq 204 ]; then
59+
echo "✅ Successfully triggered documentation rebuild"
60+
echo "🔗 View workflow at: https://github.com/soliplex/soliplex.github.io/actions"
61+
else
62+
echo "❌ Failed to trigger documentation rebuild (HTTP $http_code)"
63+
echo "$response"
64+
exit 1
65+
fi
66+
67+
- name: Notify on failure
68+
if: failure()
69+
run: |
70+
echo "::warning::Failed to trigger documentation rebuild. Check DOCS_DEPLOY_TOKEN secret."

0 commit comments

Comments
 (0)