-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (92 loc) · 3.11 KB
/
selfserve-generate-sdk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Generate SDK
on:
workflow_call:
inputs:
name:
description: 'SDK Name'
required: true
type: string
version:
description: 'SDK Version'
required: true
type: string
sdk_key:
description: 'Key to the generated SDK artifact'
default: 'sdk'
type: string
jar_key:
description: 'Key to the generated JAR artifact'
default: 'jar'
type: string
sdk_repo_ref:
description: |
Branch or tag to checkout on the `expediagroup-sdk-core` repository.
Leave empty to use the default branch.
type: string
default: ''
repository:
description: |
Repository to generate the SDK in.
Leave empty to use the current repository.
type: string
default: ''
ref:
description: |
Branch or tag to checkout on the provided repository.
Leave empty to use the default branch.
type: string
default: ''
jobs:
generate-sdk:
runs-on: ubuntu-latest
steps:
- name: Checkout generator repository
uses: actions/checkout@v4
with:
repository: 'ExpediaGroup/expediagroup-java-sdk'
ref: ${{ inputs.sdk_repo_ref }}
path: sdk-repo
- name: Checkout product repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
path: product-repo
- name: Download Specs
uses: actions/download-artifact@v4
with:
name: transformedSpecs
- name: Apply product customizations
run: |
cp -R product-repo/customizations/* sdk-repo
- name: Build Generator Post-processor
working-directory: sdk-repo/generator/openapi/src/main/resources/post-processor
run: npm ci && npm run clean && npm run compile
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Generate Product SDK
env:
KOTLIN_POST_PROCESS_FILE: "npm run --prefix sdk-repo/generator/openapi/src/main/resources/post-processor process"
run: |
mvn -f sdk-repo/generator/openapi clean install exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=./transformedSpecs.yaml"
- name: Install SDK
run: |
mvn clean install -f sdk-repo/generator/openapi/target/sdk
- name: Persist SDK Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.sdk_key }}
path: |
sdk-repo/generator/openapi/target/sdk
!sdk-repo/generator/openapi/target/sdk/target
- name: Persist JAR Artifact # TODO: Remove when product config is proposed
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.jar_key }}
path: |
sdk-repo/generator/openapi/target/sdk/target/*.jar
sdk-repo/generator/openapi/target/sdk/target/maven-archiver/pom.properties
overwrite: true