1+ ---
2+ name : Generate Property Docs
3+
4+ on :
5+ workflow_dispatch :
6+ inputs :
7+ tag :
8+ description : " Tag to use for property doc generation"
9+ required : true
10+ type : string
11+ repository_dispatch :
12+ types : [trigger-property-docs-generation]
13+
14+ jobs :
15+ generate-property-docs :
16+ runs-on : ubuntu-24.04
17+ permissions :
18+ id-token : write
19+ contents : write
20+ pull-requests : write
21+
22+ steps :
23+ - name : Configure AWS credentials
24+ uses : aws-actions/configure-aws-credentials@v4
25+ with :
26+ aws-region : ${{ vars.RP_AWS_CRED_REGION }}
27+ role-to-assume : arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
28+
29+ - name : Get secrets from AWS Secrets Manager
30+ uses : aws-actions/aws-secretsmanager-get-secrets@v2
31+ with :
32+ secret-ids : |
33+ ,sdlc/prod/github/actions_bot_token
34+ parse-json-secrets : true
35+
36+ - name : Checkout the repository
37+ uses : actions/checkout@v4
38+ with :
39+ ref : main
40+ token : ${{ env.ACTIONS_BOT_TOKEN }}
41+
42+ - name : Set up Node.js
43+ uses : actions/setup-node@v4
44+ with :
45+ node-version : 20
46+
47+ - name : Install dependencies
48+ run : npm ci
49+
50+ - name : Determine tag
51+ id : tag
52+ run : |
53+ if [ -n "${{ github.event.inputs.tag }}" ]; then
54+ echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
55+ elif [ -n "${{ github.event.client_payload.tag }}" ]; then
56+ echo "tag=${{ github.event.client_payload.tag }}" >> $GITHUB_OUTPUT
57+ else
58+ echo "❌ No tag provided via input or dispatch payload" >&2
59+ exit 1
60+ fi
61+
62+ - name : Check if tag is newer than antora.yml latest
63+ id : version_check
64+ run : |
65+ set -euo pipefail
66+ TAG="${{ steps.tag.outputs.tag }}"
67+ CURRENT=$(grep 'latest-redpanda-tag:' antora.yml | awk '{print $2}' | tr -d '"')
68+
69+ echo "📄 Current latest-redpanda-tag in antora.yml: $CURRENT"
70+ echo "🔖 Incoming tag: $TAG"
71+
72+ # Strip leading 'v' for numeric comparison
73+ CUR_NUM=$(echo "$CURRENT" | sed 's/^v//')
74+ NEW_NUM=$(echo "$TAG" | sed 's/^v//')
75+
76+ # Compare semver using sort -V
77+ if [ "$(printf "%s\n%s" "$CUR_NUM" "$NEW_NUM" | sort -V | tail -n1)" = "$NEW_NUM" ] && [ "$CUR_NUM" != "$NEW_NUM" ]; then
78+ echo "$TAG is newer than $CURRENT"
79+ echo "is_newer=true" >> $GITHUB_OUTPUT
80+ else
81+ echo "$TAG is not newer than $CURRENT — skipping doc generation"
82+ echo "is_newer=false" >> $GITHUB_OUTPUT
83+ fi
84+
85+ - name : Generate property docs
86+ if : steps.version_check.outputs.is_newer == 'true'
87+ run : |
88+ set -euo pipefail
89+ echo "Running doc generation for: ${{ steps.tag.outputs.tag }}"
90+ npx doc-tools generate property-docs \
91+ --tag "${{ steps.tag.outputs.tag }}" \
92+ --generate-partials \
93+ --cloud-support \
94+ --overrides docs-data/property-overrides.json
95+ env :
96+ GITHUB_TOKEN : ${{ env.ACTIONS_BOT_TOKEN }}
97+
98+ - name : Create pull request
99+ if : steps.version_check.outputs.is_newer == 'true'
100+ uses : peter-evans/create-pull-request@v6
101+ with :
102+ token : ${{ env.ACTIONS_BOT_TOKEN }}
103+ commit-message : " auto-docs: Update property docs for ${{ steps.tag.outputs.tag }}"
104+ branch : update-property-docs-${{ steps.tag.outputs.tag }}
105+ title : " auto-docs: Update property docs for tag ${{ steps.tag.outputs.tag }}"
106+ body : |
107+ This PR auto-generates updated Redpanda property documentation for **${{ steps.tag.outputs.tag }}**.
108+ labels : auto-docs
109+
110+ - name : Skip notice
111+ if : steps.version_check.outputs.is_newer != 'true'
112+ run : echo "Skipping doc generation — tag is not newer than latest-redpanda-tag in antora.yml."
0 commit comments