Skip to content

Commit

Permalink
Merge branch 'main' into bootstrap-package-publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwylde authored Sep 19, 2023
2 parents 400a420 + 82f8b9a commit cd106ef
Show file tree
Hide file tree
Showing 7 changed files with 3,467 additions and 1,055 deletions.
62 changes: 62 additions & 0 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build JS SDK
description: >
This action builds a JavaScript SDK and updates an existing PR with the generated files
inputs:
token:
required: true
description: 'The GH token for private repos'
runs:
using: composite
steps:
- name: Checkout current repo
uses: actions/checkout@v3
with:
path: sdk
ref: ${{ github.event.pull_request.head.ref }}

- name: Checkout OpenAPI Tools
uses: actions/checkout@v3
with:
repository: kong/openapi-generator-config
path: openapi-generator-config
token: ${{inputs.token}}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Install Dependencies
shell: bash
run: |
npm install -g @openapitools/[email protected]
- name: Create generator config
shell: bash
working-directory: sdk
run: |
shopt -s extglob
rm -r !(openapi.yaml)
cp ../openapi-generator-config/openapitools-js.json openapitools.json
cp -r ../openapi-generator-config/templates-js .
- name: "Generate Node SDK"
shell: bash
working-directory: sdk
run: |
openapi-generator-cli generate --generator-key client
- name: "Clean up generator files"
shell: bash
working-directory: sdk/src
run: |
rm -rf openapitools.json templates-js .openapi-generator-ignore .openapi-generator git_push.sh
- name: Commit SDK changes to the PR
uses: EndBug/add-and-commit@v9
with:
cwd: sdk
add: src
default_author: github_actions
message: Update SDK based on openapi.yaml changes
25 changes: 24 additions & 1 deletion .github/workflows/generate-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,28 @@ jobs:
name: Generate JavaScript SDK
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.ref }}
path: actions

- name: Build JavaScript SDK
uses: Kong/shared-actions/build-js-sdk@main
uses: Kong/public-shared-actions/code-build-actions/build-js-sdk@main
with:
app_directory: ${{ github.workspace }}
sdk_output_directory: ${{ github.workspace }}/actions
token: ${{ secrets.GITHUB_TOKEN }}

- name: Commit SDK changes to the PR
shell: bash
working-directory: ${{ github.workspace }}/actions
env:
GH_TOKEN: ${{ secrets.PORTAL_JS_SDK_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "team-devx"
gh pr checkout ${{ github.event.pull_request.number }}
git add src/
git commit --allow-empty -m "Update SDK based on openapi.yaml changes"
git push
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0] - 2023-08-08

### Added

- `queryApplicationAnalytics()` method for getting stats about portal applications

## [2.0.0] - 2023-08-08

### Changed

- Version 2.0.0 of the SDK is identical to 1.0.0. Each subsequent SDK version number will match the version of Portal API that the SDK is built for.

## [1.0.0] - 2023-06-23

### Added

- Stable release of the SDK for Portal API v2 [reference doc](https://developer.konghq.com/spec/2aad2bcb-8d82-43b3-abdd-1d5e6e84dbd6/b4539157-4ced-4df5-affa-7d790baee356)
Loading

0 comments on commit cd106ef

Please sign in to comment.