Skip to content

API spec v3.10 - update 1 #55

API spec v3.10 - update 1

API spec v3.10 - update 1 #55

name: Generate OpenAPI Clients
# For testing use the PR name for 'branches:' - once done testing revert the 'branches:' name to main
on:
push:
branches: [ V3_10 ]
# pull_request:
# branches: [ main ]
jobs:
generate-eMASS-clients:
runs-on: ubuntu-latest
name: Generate OpenAPI Clients
steps:
# Checkout your code
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
# Check for changed files (looking for changes to the eMASSRestOpenApi.yaml file)
- name: Get changed files 🔧
id: changed-files
uses: tj-actions/changed-files@v21
# Use the action to generate a client package
# This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace.
- name: Generate Ruby Client 🏭
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: ruby
config-file: src/openapi/templates/ruby/ruby-generator-config.json
template-dir: src/openapi/templates/ruby
openapi-file: eMASSRestOpenApi.yaml
if: contains(steps.changed-files.outputs.modified_files, 'eMASSRestOpenApi.yaml')
- name: Generate Typescript Client 🏭
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: typescript-axios
config-file: src/openapi/templates/typescript/typescript-generator-config.json
template-dir: src/openapi/templates/typescript
openapi-file: eMASSRestOpenApi.yaml
if: contains(steps.changed-files.outputs.modified_files, 'eMASSRestOpenApi.yaml')
- name: Generate Python Client 🏭
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: python
config-file: src/openapi/templates/python/python-generator-config.json
template-dir: src/openapi/templates/python/mustache
openapi-file: eMASSRestOpenApi.yaml
if: contains(steps.changed-files.outputs.modified_files, 'eMASSRestOpenApi.yaml')
# Publish the newly generated eMASS client to the current repo
- name: Publish Generated Clients 🚀
if: contains(steps.changed-files.outputs.modified_files, 'eMASSRestOpenApi.yaml')
env:
CI_COMMIT_MESSAGE: Continuous Integration Build Client Artifacts (eMASS Clients)
CI_COMMIT_AUTHOR: Continuous Integration
# Use previous user who made the last commit (from logs)
# CI_COMMIT_AUTHOR: "$(git log -n 1 --pretty=format:%an)"
CI_COMMIT_EMAIL: "$(git log -n 1 --pretty=format:%ae)"
run: |
# echo "Renaming generated directory from ruby-client to ruby_client..."
rm -R src/ruby_client
mv ruby-client src/ruby_client
# echo "Renaming generated directory from typescript-axios-client to typescript_client..."
rm -R src/typescript_client
mv typescript-axios-client src/typescript_client
# echo "Renaming generated directory from python-client to python_client..."
rm -R src/python_client
mv python-client src/python_client
# echo "GIT commit and push eMASS clients..."
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git add src/ruby_client src/typescript_client src/python_client
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push -f
echo "All done now."