Skip to content
58 changes: 56 additions & 2 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,34 @@ jobs:
echo "overlay_paths=$OVERLAYS" >> $GITHUB_OUTPUT
echo "Using overlays: $OVERLAYS"

- name: Deploy API documentation (admin v1)
if: ${{ steps.format.outputs.file_path == 'admin/admin.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{secrets.BUMP_TOKEN}}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
branch: v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy API documentation (admin v2)
if: ${{ steps.format.outputs.file_path == 'admin/admin-v2.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{secrets.BUMP_TOKEN}}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
branch: v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy API documentation
- name: Deploy API documentation (other files)
if: ${{ steps.format.outputs.file_path != 'admin/admin.yaml' && steps.format.outputs.file_path != 'admin/admin-v2.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
Expand Down Expand Up @@ -183,8 +209,22 @@ jobs:
echo "overlay_paths=$OVERLAYS" >> $GITHUB_OUTPUT
echo "Using overlays: $OVERLAYS"

- name: Comment pull request with API diff (admin v1)
if: ${{ steps.format.outputs.file_path == 'admin/admin.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{secrets.BUMP_TOKEN}}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
command: diff
branch: v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment pull request with API diff
- name: Comment pull request with API diff (admin v2)
if: ${{ steps.format.outputs.file_path == 'admin/admin-v2.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
Expand All @@ -193,5 +233,19 @@ jobs:
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
command: diff
branch: v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment pull request with API diff (other files)
if: ${{ steps.format.outputs.file_path != 'admin/admin.yaml' && steps.format.outputs.file_path != 'admin/admin-v2.yaml' }}
uses: bump-sh/github-action@v1
with:
hub: redpanda
doc: ${{ matrix.doc_id }}
token: ${{secrets.BUMP_TOKEN}}
file: ${{ steps.format.outputs.file_path }}
overlay: ${{ steps.overlays.outputs.overlay_paths }}
command: diff
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84 changes: 84 additions & 0 deletions .github/workflows/get-admin-api-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Bundle Admin OpenAPI Spec

on:
repository_dispatch:
types: [redpanda-openapi-bundle]
workflow_dispatch:
inputs:
tag:
description: 'Redpanda tag to bundle (such as v24.3.2)'
required: true
type: string

permissions:
contents: write
pull-requests: write

concurrency:
group: openapi-${{ github.event.client_payload.tag || inputs.tag || github.run_id }}
cancel-in-progress: false

jobs:
bundle:
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.client_payload.tag || inputs.tag }}
steps:

- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.RP_AWS_CRED_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}

- uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,sdlc/prod/github/actions_bot_token
parse-json-secrets: true

- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ env.ACTIONS_BOT_TOKEN }}

- name: Set up Node.js (with npm cache)
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- name: Validate tag
run: |
if [ -z "${TAG}" ]; then
echo "ERROR: No tag provided. Pass client_payload.tag on repository_dispatch or use workflow_dispatch input."
exit 1
fi
echo "Using tag: ${TAG}"
- name: Install dependencies
run: npm install

- name: Install tools
run: |
npx doc-tools install-test-dependencies
- name: Generate RPCN Connector docs
id: generate
run: |
npx doc-tools generate bundle-openapi --tag "${TAG}" --use-admin-major-version --surface admin --out-admin admin/admin-v2.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ env.ACTIONS_BOT_TOKEN }}
base: main
branch: auto-docs/admin-api
title: 'auto-docs: Update Admin API docs for ${{ env.TAG }}'
commit-message: 'docs: Update Admin API docs for ${{ env.TAG }}'
body: |
This PR adds the latest OpenAPI spec for version **${{ env.TAG }}** of the Redpanda Admin API:
```
npx doc-tools generate bundle-openapi --tag ${{ env.TAG }} --use-admin-major-version --surface admin --out-admin admin/admin.yaml
```
labels: auto-docs
Loading