[SDK: ruby/python/C#] Add initial module: createCaseHealth (RS-EDA) #17
Workflow file for this run
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 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_NAME based on the trigger type | |
run: | | |
if [[ "${{ github.event_name }}" == "release" ]]; then | |
RELEASE_NAME="${{ github.ref_name }}" | |
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
RELEASE_NAME="${{ github.event.inputs.release_name }}" | |
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
RELEASE_NAME="${{ github.head_ref }}" | |
fi | |
# Export the RELEASE_NAME environment variable for future steps (in env.RELEASE_NAME) | |
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | |
# Echo the RELEASE_NAME for verification | |
echo "The RELEASE_NAME is: $RELEASE_NAME" | |
- 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 | |
mv generator/ruby/ruby_classes/lib 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.GEM_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 classes et des specs |