Update build.yml #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate API Client | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
generate-api-client: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: npm install | |
- name: Generate API Client | |
env: | |
OPEN_API_FILE_PATH: "./swagger.json" | |
OPEN_API_GENERATE_CONFIG: "./advancer_api_client.config.json" | |
OPEN_API_GENERATE_DIRECTORY: "./api_client" | |
run: | | |
npx openapi-generator-cli generate -i "$OPEN_API_FILE_PATH" -g typescript-axios -c "$OPEN_API_GENERATE_CONFIG" -o "$OPEN_API_GENERATE_DIRECTORY" -t "./typescript_generator_templates" | |
cd "$OPEN_API_GENERATE_DIRECTORY" | |
npm i axios@latest | |
npm i -D @types/node@latest typescript@latest | |
npm run build | |
- name: Commit Generated Code | |
run: | | |
git config numanbtt "GitHub Actions" | |
git config numanbtt@gmail.com "actions@github.com" | |
git add ./api_client | |
git commit -m "Update generated API client" | |
git push |