Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 46 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ on:
required: false
default: ''
type: string
triggering_pr_number:
description: 'PR number that triggered this deployment'
required: false
default: ''
type: string
triggering_pr_title:
description: 'PR title that triggered this deployment'
required: false
default: ''
type: string
triggering_commit_sha:
description: 'Commit SHA that triggered this deployment'
required: false
default: ''
type: string
triggering_branch:
description: 'Branch that triggered this deployment'
required: false
default: ''
type: string

# Ensure only latest deployment runs
concurrency:
Expand All @@ -19,6 +39,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Log deployment trigger information
run: |
echo "🚀 Starting documentation deployment"
echo "📋 Trigger Information:"
echo " - Branch: ${{ inputs.triggering_branch || 'N/A' }}"
echo " - Commit: ${{ inputs.triggering_commit_sha || 'N/A' }}"
echo " - PR: ${{ inputs.triggering_pr_number && format('#{0} - {1}', inputs.triggering_pr_number, inputs.triggering_pr_title) || 'N/A (direct push)' }}"
echo " - Timestamp: $(date)"
echo " - Workflow Run: ${{ github.run_id }}"
echo " - Subfolder: ${{ inputs.subfolder || '(root deployment)' }}"

- name: Checkout production branch
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -287,10 +318,16 @@ jobs:

This PR contains automatically merged documentation from multiple branches.

**Generated from:** `branches-config.json`
**Timestamp:** ${{ github.event.head_commit.timestamp }}
**Run ID:** ${{ github.run_id }}
**Subfolder:** `${{ inputs.subfolder || '(root deployment)' }}`
**Triggered by:**
- **Branch:** ${{ inputs.triggering_branch || 'N/A' }}
- **Commit:** ${{ inputs.triggering_commit_sha || 'N/A' }}
- **PR:** ${{ inputs.triggering_pr_number && format('#{0} - {1}', inputs.triggering_pr_number, inputs.triggering_pr_title) || 'N/A (direct push)' }}

**Deployment Details:**
- **Generated from:** `branches-config.json`
- **Run ID:** ${{ github.run_id }}
- **Subfolder:** `${{ inputs.subfolder || '(root deployment)' }}`
- **Timestamp:** $(date)

### Changes Include:
- ✅ Merged documentation from multiple branches
Expand Down Expand Up @@ -337,6 +374,11 @@ jobs:
run: |
echo "## 📚 Documentation Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🚀 Trigger Information" >> $GITHUB_STEP_SUMMARY
echo "- **Branch:** ${{ inputs.triggering_branch || 'N/A' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Commit:** ${{ inputs.triggering_commit_sha || 'N/A' }}" >> $GITHUB_STEP_SUMMARY
echo "- **PR:** ${{ inputs.triggering_pr_number && format('#{0} - {1}', inputs.triggering_pr_number, inputs.triggering_pr_title) || 'N/A (direct push)' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ✅ Successfully merged documentation" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Generated files:**" >> $GITHUB_STEP_SUMMARY
Expand Down
57 changes: 56 additions & 1 deletion .github/workflows/trigger-docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,65 @@ jobs:
trigger-deploy:
runs-on: ubuntu-latest
steps:
- name: Extract PR information from commit
id: get-pr
run: |
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
echo "Commit message: $COMMIT_MESSAGE"

# Try to extract PR number from commit message
PR_NUMBER=$(echo "$COMMIT_MESSAGE" | grep -oE '#[0-9]+' | head -1 | sed 's/#//')

if [ -n "$PR_NUMBER" ]; then
echo "Found PR number: #$PR_NUMBER"
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "has_pr=true" >> $GITHUB_OUTPUT

# Extract PR title (everything before the PR number reference)
PR_TITLE=$(echo "$COMMIT_MESSAGE" | sed 's/ (#[0-9]\+).*//' | head -1)
echo "pr_title=$PR_TITLE" >> $GITHUB_OUTPUT
else
echo "No PR number found in commit message (direct push)"
echo "has_pr=false" >> $GITHUB_OUTPUT
fi

- name: Trigger production deployment
run: |
# Prepare the dispatch payload
if [ "${{ steps.get-pr.outputs.has_pr }}" = "true" ]; then
PAYLOAD=$(jq -n \
--arg ref "production" \
--arg pr_number "${{ steps.get-pr.outputs.pr_number }}" \
--arg pr_title "${{ steps.get-pr.outputs.pr_title }}" \
--arg commit_sha "${{ github.sha }}" \
--arg branch "${{ github.ref_name }}" \
'{
ref: $ref,
inputs: {
triggering_pr_number: $pr_number,
triggering_pr_title: $pr_title,
triggering_commit_sha: $commit_sha,
triggering_branch: $branch
}
}')
echo "Triggering deployment with PR #${{ steps.get-pr.outputs.pr_number }}"
else
PAYLOAD=$(jq -n \
--arg ref "production" \
--arg commit_sha "${{ github.sha }}" \
--arg branch "${{ github.ref_name }}" \
'{
ref: $ref,
inputs: {
triggering_commit_sha: $commit_sha,
triggering_branch: $branch
}
}')
echo "Triggering deployment (direct push, no PR)"
fi

curl -X POST \
-H "Authorization: token ${{ secrets.ORG_GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/deploy-docs.yml/dispatches \
-d '{"ref": "production"}'
-d "$PAYLOAD"