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