|
| 1 | +# Template: SDK Release Documentation Notification |
| 2 | +# |
| 3 | +# Copy this workflow to your SDK repository and configure the SDK_TYPE variable. |
| 4 | +# When a release is published, it will notify the sendbird-docs repository to |
| 5 | +# generate documentation updates based on the release notes. |
| 6 | +# |
| 7 | +# Required setup: |
| 8 | +# 1. Copy this file to your SDK repo: .github/workflows/notify-docs-update.yml |
| 9 | +# 2. Update the SDK_TYPE environment variable to match your SDK |
| 10 | +# 3. Create a GitHub Personal Access Token with 'repo' scope |
| 11 | +# 4. Add the token as a secret named DOCS_REPO_TOKEN in your SDK repo |
| 12 | +# |
| 13 | +# SDK_TYPE options: |
| 14 | +# - chat-sdk-javascript |
| 15 | +# - chat-sdk-ios |
| 16 | +# - chat-sdk-android |
| 17 | +# - chat-sdk-flutter |
| 18 | +# - chat-sdk-unity |
| 19 | +# - uikit-react |
| 20 | +# - uikit-react-native |
| 21 | +# - uikit-ios |
| 22 | +# - uikit-android |
| 23 | +# - uikit-swiftui |
| 24 | + |
| 25 | +name: Notify Docs Repository on Release |
| 26 | + |
| 27 | +on: |
| 28 | + release: |
| 29 | + types: [published] |
| 30 | + |
| 31 | +env: |
| 32 | + # UPDATE THIS: Set to your SDK type (see options above) |
| 33 | + SDK_TYPE: chat-sdk-unity |
| 34 | + DOCS_REPO: sendbird/sendbird-docs |
| 35 | + |
| 36 | +jobs: |
| 37 | + notify-docs: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Trigger documentation update |
| 41 | + env: |
| 42 | + GH_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }} |
| 43 | + run: | |
| 44 | + # Extract repository info |
| 45 | + SDK_REPO="${{ github.repository }}" |
| 46 | + RELEASE_TAG="${{ github.event.release.tag_name }}" |
| 47 | + RELEASE_URL="${{ github.event.release.html_url }}" |
| 48 | +
|
| 49 | + echo "Triggering docs update for:" |
| 50 | + echo " SDK Repo: $SDK_REPO" |
| 51 | + echo " Release Tag: $RELEASE_TAG" |
| 52 | + echo " SDK Type: $SDK_TYPE" |
| 53 | +
|
| 54 | + # Trigger repository_dispatch event on docs repo |
| 55 | + curl -X POST \ |
| 56 | + -H "Accept: application/vnd.github+json" \ |
| 57 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 58 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 59 | + "https://api.github.com/repos/${{ env.DOCS_REPO }}/dispatches" \ |
| 60 | + -d "{ |
| 61 | + \"event_type\": \"sdk-release\", |
| 62 | + \"client_payload\": { |
| 63 | + \"sdk_repo\": \"$SDK_REPO\", |
| 64 | + \"release_tag\": \"$RELEASE_TAG\", |
| 65 | + \"sdk_type\": \"${{ env.SDK_TYPE }}\", |
| 66 | + \"release_url\": \"$RELEASE_URL\" |
| 67 | + } |
| 68 | + }" |
| 69 | +
|
| 70 | + echo "Documentation update triggered successfully!" |
| 71 | +
|
| 72 | + - name: Summary |
| 73 | + run: | |
| 74 | + echo "## Documentation Update Triggered" >> $GITHUB_STEP_SUMMARY |
| 75 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 76 | + echo "A documentation update request has been sent to the docs repository." >> $GITHUB_STEP_SUMMARY |
| 77 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 78 | + echo "- **SDK:** ${{ env.SDK_TYPE }}" >> $GITHUB_STEP_SUMMARY |
| 79 | + echo "- **Release:** ${{ github.event.release.tag_name }}" >> $GITHUB_STEP_SUMMARY |
| 80 | + echo "- **Docs Repo:** ${{ env.DOCS_REPO }}" >> $GITHUB_STEP_SUMMARY |
0 commit comments