Skip to content

[SDK: ruby/python/C#] Add initial module: createCaseHealth (RS-EDA) #26

[SDK: ruby/python/C#] Add initial module: createCaseHealth (RS-EDA)

[SDK: ruby/python/C#] Add initial module: createCaseHealth (RS-EDA) #26

Workflow file for this run

name: Generate SDKs
on:
pull_request:
branches:
- '**'
release:
types:
- published
workflow_dispatch:
inputs:
release_name:
description: 'Release name for manual dispatch'
required: true
# Workflow dependencies, also to avoid concurrent commits
# Ref.: https://github.com/orgs/community/discussions/26238
workflow_run:
workflows: ["generate-model"]
types:
- completed
env:
SCHEMAS: "RC-EDA RS-EDA EMSI GEO-POS GEO-REQ GEO-RES RC-REF RS-ERROR RS-RI RS-DR RS-RR RPIS"
jobs:
generate-sdks:
runs-on: ubuntu-latest
steps:
- name: Set RELEASE_VERSION based on the trigger type
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
RELEASE_VERSION="${{ github.ref_name }}"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
RELEASE_VERSION="${{ github.event.inputs.release_name }}"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
RELEASE_VERSION="0.0.0.${{ github.head_ref }}"
fi
# Make the RELEASE_VERSION semver compatible (replacing non letter/digit/. chars with .)
RELEASE_VERSION=$(echo "$RELEASE_VERSION" | sed 's/[^a-zA-Z0-9\.]/./g')
# Echo the RELEASE_VERSION for verification
echo "The RELEASE_VERSION is: $RELEASE_VERSION"
# Check if RELEASE_VERSION matches the semver allowed pattern
if [[ ! $RELEASE_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9].* ]]; then
echo "RELEASE_VERSION is NOT semver compatible (1.1.1-xxx)"
exit 1
fi
# Export the RELEASE_VERSION environment variable for future steps (in env.RELEASE_VERSION)
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Install node env 🏗
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install openapi-generator-cli
run: npm install -g @openapitools/openapi-generator-cli
- name: Cleaning output directories
working-directory: ./generator
run: |
rm -r ruby python csharp || true
- name: Ruby - Generate classes
working-directory: ./generator
run: |
npx @openapitools/openapi-generator-cli generate -c ./config/EDXL-DE/ruby/EDXL-DE.generator-config.json --skip-validate-spec
IFS=' ' read -ra SCHEMAS_ARRAY <<< "$SCHEMAS"
for SCHEMA in "${SCHEMAS_ARRAY[@]}"; do
npx @openapitools/openapi-generator-cli generate -c ./config/$SCHEMA/ruby/$SCHEMA.generator-config.json --skip-validate-spec
done
- name: Ruby - Move classes to SDK folder
run: |
rm -r sdks/ruby/lib || true
mkdir sdks/ruby/lib
cp -r sdks/ruby/base/* sdks/ruby/lib/
rsync --remove-source-files generator/ruby/ruby_classes/* sdks/ruby/
- name: Ruby - Set up
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Ruby - Build gem, push it to GitHub Packages and remove it
working-directory: ./sdks/ruby/
run: |
gem build hubsante_model.gemspec
gem push --key github --host https://rubygems.pkg.github.com/ansforge ./hubsante_model-*.gem
rm ./hubsante_model-*.gem
env:
GEM_VERSION: ${{ env.RELEASE_VERSION }}
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }} # GitHub token used to authenticate
- name: Python - Generate classes
working-directory: ./generator
run: |
npx @openapitools/openapi-generator-cli generate -c ./config/RS-EDA/python/RS-EDA.generator-config.json --skip-validate-spec
- name: C# - Generate classes
working-directory: ./generator
run: |
npx @openapitools/openapi-generator-cli generate -c ./config/RS-EDA/csharp/RS-EDA.generator-config.json --skip-validate-spec
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ⚙️ Auto-génération des SDKs