|
| 1 | +name: Generate and Publish SDK (Full Workflow) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + name: |
| 7 | + description: 'SDK Name' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + version: |
| 11 | + description: | |
| 12 | + SDK Version. |
| 13 | + E.g., 1.0.0, 1.0.1, 1.0.0-SNAPSHOT, etc. |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + templates: |
| 17 | + description: | |
| 18 | + Path to the templates directory. |
| 19 | + Use the default path if you are using the default templates. |
| 20 | + Use `sdk-repo` to refer to the `expediagroup-sdk` repo root path if needed. |
| 21 | + type: string |
| 22 | + default: 'sdk-repo/generator/openapi/src/main/resources/templates/expediagroup-sdk' |
| 23 | + repository: |
| 24 | + description: | |
| 25 | + Repository to generate the SDK in. |
| 26 | + Leave empty to use the current repository. |
| 27 | + type: string |
| 28 | + default: '' |
| 29 | + ref: |
| 30 | + description: | |
| 31 | + Branch or tag to checkout. |
| 32 | + Leave empty to use the default branch. |
| 33 | + type: string |
| 34 | + default: '' |
| 35 | + specs_key: |
| 36 | + description: | |
| 37 | + Key to the OpenAPI specs artifact and name |
| 38 | + (without extension, e.g. specs, the file is expected to have the extension .yaml). |
| 39 | + The artifact is expected to be in the root of the repository, unless you specify a different path |
| 40 | + using the specs_path input. |
| 41 | + type: string |
| 42 | + default: 'specs' |
| 43 | + specs_path: |
| 44 | + description: 'Path to the specs file in the provided repository' |
| 45 | + type: string |
| 46 | + default: 'specs.yaml' |
| 47 | + transformed_specs_key: |
| 48 | + description: | |
| 49 | + Key to the transformed specs artifact and name. |
| 50 | + (without extension, e.g. transformedSpecs, the file is expected to have the extension .yaml). |
| 51 | + This artifact will be generated by the transformation job and used to generate the SDK. |
| 52 | + This artifact will be published with this name into the provided sources_path directory. |
| 53 | + type: string |
| 54 | + default: 'transformedSpecs' |
| 55 | + transformations: |
| 56 | + description: 'Spec Transformer CLI Configurations' |
| 57 | + type: string |
| 58 | + default: '--headers --operationIdsToTags' |
| 59 | + sources_path: |
| 60 | + description: 'Path to publish the source code to. This should be a path of a directory where the source code will be published to' |
| 61 | + type: string |
| 62 | + default: 'code' |
| 63 | + sdk_key: |
| 64 | + description: | |
| 65 | + Key to the generated SDK artifact. |
| 66 | + This artifact will be generated by the generation job and used to publish the SDK. |
| 67 | + type: string |
| 68 | + default: 'sdk' |
| 69 | + |
| 70 | + |
| 71 | +jobs: |
| 72 | + show-inputs: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Show inputs |
| 76 | + run: | |
| 77 | + echo "SDK Name: ${{ inputs.name }}" |
| 78 | + echo "SDK Version: ${{ inputs.version }}" |
| 79 | + echo "Templates: ${{ inputs.templates }}" |
| 80 | + echo "Repository: ${{ inputs.repository }}" |
| 81 | + echo "Ref: ${{ inputs.ref }}" |
| 82 | + echo "Specs Key: ${{ inputs.specs_key }}" |
| 83 | + echo "Specs Path: ${{ inputs.specs_path }}" |
| 84 | + echo "Transformed Specs Key: ${{ inputs.transformed_specs_key }}" |
| 85 | + echo "Transformations: ${{ inputs.transformations }}" |
| 86 | + echo "Sources Path: ${{ inputs.sources_path }}" |
| 87 | + echo "SDK Key: ${{ inputs.sdk_key }}" |
| 88 | +
|
| 89 | + upload-specs: |
| 90 | + uses: ./.github/workflows/selfserve-upload-specs.yaml |
| 91 | + with: |
| 92 | + specs_key: ${{ inputs.specs_key }} |
| 93 | + specs_path: ${{ inputs.specs_path }} |
| 94 | + repository: ${{ inputs.repository }} |
| 95 | + ref: ${{ inputs.ref }} |
| 96 | + |
| 97 | + transform-specs: |
| 98 | + uses: ./.github/workflows/selfserve-transform-specs.yaml |
| 99 | + needs: [ upload-specs ] |
| 100 | + with: |
| 101 | + specs_key: ${{ inputs.specs_key }} |
| 102 | + transformations: ${{ inputs.transformations }} |
| 103 | + transformed_specs_key: ${{ inputs.transformed_specs_key }} |
| 104 | + |
| 105 | + generate-sdk: |
| 106 | + uses: ./.github/workflows/selfserve-generate.yaml |
| 107 | + needs: [ transform-specs ] |
| 108 | + with: |
| 109 | + name: ${{ inputs.name }} |
| 110 | + version: ${{ inputs.version }} |
| 111 | + templates: ${{ inputs.templates }} |
| 112 | + specs_key: ${{ inputs.transformed_specs_key }} |
| 113 | + sdk_key: ${{ inputs.sdk_key }} |
| 114 | + |
| 115 | + publish-sources: |
| 116 | + uses: ./.github/workflows/selfserve-publish-sources.yaml |
| 117 | + needs: [ generate-sdk ] |
| 118 | + with: |
| 119 | + version: ${{ inputs.version }} |
| 120 | + path: ${{ inputs.sources_path }} |
| 121 | + sdk_key: ${{ inputs.sdk_key }} |
| 122 | + specs_key: ${{ inputs.transformed_specs_key }} |
| 123 | + |
| 124 | + release: |
| 125 | + uses: ./.github/workflows/selfserve-release.yaml |
| 126 | + needs: [ generate-sdk, publish-sources ] |
| 127 | + with: |
| 128 | + sdk_key: ${{ inputs.sdk_key }} |
0 commit comments