Skip to content

Updating Definitions #86

Updating Definitions

Updating Definitions #86

Workflow file for this run

name: Generate SDKs
on:
workflow_dispatch:
push:
branches:
- 'release-**'
jobs:
preprocess-specifications:
name: Preprocess OpenAPI specifications
runs-on: ubuntu-22.04
env:
ORIG_SPEC_DIR: ${{ github.workspace }}/res
SPEC_DIR: ${{ github.workspace }}/specs_preprocessed
PREPROCESSING_DIR: ${{ github.workspace }}/sdk-blueprints/preprocessing
steps:
- name: Checkout workflow repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Preprocess OpenAPI specifications
id: preprocess
run: |
python3 -m pip install -r $PREPROCESSING_DIR/requirements.txt
python3 $PREPROCESSING_DIR/preprocessing.py $ORIG_SPEC_DIR $SPEC_DIR
- name: Upload preprocessed specifications as artifact
uses: actions/upload-artifact@v4
with:
name: processed-specs-${{ github.ref_name }}
path: ${{ env.SPEC_DIR }}
retention-days: 7
generate-python-sdk:
name: Generate Python SDK
needs: preprocess-specifications
uses: ./.github/workflows/generate-python-sdk.yml
secrets: inherit
with:
python_sdk_pr_base_branch: ${{ vars.PYTHON_SDK_PR_BASE_BRANCH }}
create-and-merge-pr:
name: Create and Merge Pull Request for release
needs: generate-python-sdk
runs-on: ubuntu-22.04
env:
OPENAPI_CLIENT_PR_BASE_BRANCH: ${{ vars.OPENAPI_CLIENT_PR_BASE_BRANCH }}
permissions:
contents: write
pull-requests: write
outputs:
pr_number: ${{ steps.create_pr.outputs.pr_number }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create a token
id: create-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request for openapi-clients
id: create_pr
env:
GH_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
pr_output=$(gh pr create \
--title "PR for ${{ github.ref_name }}" \
--body "This PR created automatically after pushing changes to language-sdk repos." \
--head "${{ github.ref_name }}" \
--base "${{ env.OPENAPI_CLIENT_PR_BASE_BRANCH }}")
pr_number=$(echo "$pr_output" | grep -oE '[0-9]+$')
echo "Pull Request #$pr_number created successfully."
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
- name: Merge Pull Request
env:
GH_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
gh pr merge ${{ steps.create_pr.outputs.pr_number }} \
--squash \
--delete-branch \
--subject "Auto-merge: Update openapi"