Skip to content

Commit

Permalink
Merge pull request #1123 from Permify/sdk-generator
Browse files Browse the repository at this point in the history
feat: sdk generators
  • Loading branch information
tolgaOzen authored Mar 14, 2024
2 parents 8c90804 + 090cf19 commit fb74a5d
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/sdk-generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Generate Client SDKs from OpenAPI

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.SDK_GH_TOKEN }}
ORG_NAME: permify
SWAGGER_PATH: docs/apidocs.swagger.json

strategy:
matrix:
language: [python, javascript]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Generate Python Client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: ${{ matrix.language }}
openapi-file: ${SWAGGER_PATH}
command-args: -o permify-client --git-user-id ${ORG_NAME} --git-repo-id permify-${{ matrix.language }} --api-package permify --package-name permify

- name: Push SDK to GitHub
run: |
git config --global user.name 'GitHub Actions Bot'
git config --global user.email '<>'
git clone https://${GITHUB_TOKEN}@github.com/${ORG_NAME}/permify-${{ matrix.language }}.git temp
cp -r permify-client/* temp/
cd temp
git add .
git diff-index --quiet HEAD || git commit -m "Update ${{ matrix.language }} SDK from OpenAPI changes"
git push https://${GITHUB_TOKEN}@github.com/${ORG_NAME}/permify-${{ matrix.language }}.git main --force
rm -rf permify-client

0 comments on commit fb74a5d

Please sign in to comment.