Skip to content

Commit 635694e

Browse files
authored
Merge branch 'main' into OmarAlJarrah/enable-service-virtualization-for-contract-tests
2 parents aa35dca + b34fa56 commit 635694e

File tree

12 files changed

+259
-50
lines changed

12 files changed

+259
-50
lines changed

.github/workflows/generator-main.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ on:
66
description: 'SDK Name'
77
required: true
88
version:
9-
description: 'SDK Version'
9+
description: |
10+
SDK Version
11+
12+
⚠️ For a snapshot version, append `-SNAPSHOT` to the version number, in the format `1.0.0-SNAPSHOT`,
13+
in addition to not selecting the `Release to production` option below.
1014
required: true
1115
endpoint_prefix:
1216
description: 'Endpoint to prepend specs paths with'
@@ -17,7 +21,11 @@ on:
1721
required: true
1822
type: string
1923
production_release:
20-
description: 'Release to production'
24+
description: |
25+
Release to production
26+
27+
⚠️ Please ensure that the version number includes the `-SNAPSHOT` suffix if this option is not selected,
28+
otherwise the SDK will be published to Maven Central (production).
2129
required: true
2230
type: boolean
2331
default: false
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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 }}

.github/workflows/selfserve-generate.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ on:
1616
required: true
1717
type: string
1818
specs_key:
19-
description: 'Key to the transformed and ready to use specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)'
19+
description: |
20+
Key to the transformed and ready to use specs artifact and name
21+
(without extension, e.g. specs, the file is expected to have the extension .yaml).
2022
default: 'transformedSpecs'
2123
type: string
2224
sdk_key:

.github/workflows/selfserve-publish-sources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
type: string
1010
path:
1111
description: 'Path to publish the source code to. This should be a path of a directory where the source code will be published to'
12-
required: true
12+
default: 'code'
1313
type: string
1414
sdk_key:
1515
description: 'Key to the generated SDK artifact'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release an SDK to Maven Central
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
sdk_key:
7+
description: 'Key to the generated SDK artifact'
8+
default: 'sdk'
9+
type: string
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up JDK 21
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '21'
19+
distribution: 'temurin'
20+
server-id: oss-sonatype
21+
server-username: SONATYPE_USERNAME
22+
server-password: SONATYPE_PASSWORD
23+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
24+
gpg-passphrase: GPG_PASSPHRASE
25+
settings-path: ${{ github.workspace }}
26+
27+
- name: Download SDK Artifact
28+
uses: actions/download-artifact@v4
29+
with:
30+
name: ${{ inputs.sdk_key }}
31+
path: sdk
32+
33+
- name: Release SDK
34+
working-directory: sdk
35+
env:
36+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
37+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
38+
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
39+
run: |
40+
echo "Starting SDK Release - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
41+
mvn deploy --settings $GITHUB_WORKSPACE/settings.xml -B -U -P release -DskipTests=true
42+
echo "SDK Released"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload Specs (from Repo)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
repository:
7+
description: |
8+
Repository to download the specs from.
9+
Leave empty to use the current repository.
10+
type: string
11+
default: ''
12+
ref:
13+
description: |
14+
Branch or tag to checkout.
15+
Leave empty to use the default branch.
16+
type: string
17+
default: ''
18+
specs_key:
19+
description: 'Key to the specs artifact'
20+
type: string
21+
default: 'specs'
22+
specs_path:
23+
description: 'Path to the specs file'
24+
type: string
25+
default: 'specs.yaml'
26+
27+
jobs:
28+
upload-specs:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
repository: ${{ inputs.repository }}
35+
ref: ${{ inputs.ref }}
36+
37+
- name: Upload specs
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: ${{ inputs.specs_key }}
41+
path: ${{ inputs.specs_path }}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
22
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

generator/openapi/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<openapi-generator.version>6.6.0</openapi-generator.version>
7474

7575
<!-- Plugin Versions -->
76-
<exec-maven-plugin.version>3.3.0</exec-maven-plugin.version>
76+
<exec-maven-plugin.version>3.4.1</exec-maven-plugin.version>
7777
<ktlint-plugin.version>3.2.0</ktlint-plugin.version>
7878
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
7979
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>

generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
<ktor.version>2.3.12</ktor.version>
8686
<kotlin-atomic.version>0.25.0</kotlin-atomic.version>
8787
<slf4j.version>2.0.13</slf4j.version>
88+
<maven.nexus-staging.plugin.version>1.7.0</maven.nexus-staging.plugin.version>
89+
<maven.gpg.plugin.version>3.2.5</maven.gpg.plugin.version>
8890
</properties>
8991

9092
<dependencyManagement>
@@ -393,12 +395,6 @@
393395
</configuration>
394396
</plugin>
395397

396-
<plugin>
397-
<groupId>org.apache.maven.plugins</groupId>
398-
<artifactId>maven-resources-plugin</artifactId>
399-
<version>${maven-resources-plugin.version}</version>
400-
</plugin>
401-
402398
<plugin>
403399
<groupId>org.apache.maven.plugins</groupId>
404400
<artifactId>maven-compiler-plugin</artifactId>
@@ -678,6 +674,11 @@
678674
<groupId>com.fasterxml.jackson.core</groupId>
679675
<artifactId>jackson-annotations</artifactId>
680676
</dependency>
677+
<dependency>
678+
<groupId>com.fasterxml.jackson.datatype</groupId>
679+
<artifactId>jackson-datatype-jsr310</artifactId>
680+
<scope>runtime</scope>
681+
</dependency>
681682
<dependency>
682683
<groupId>org.jetbrains</groupId>
683684
<artifactId>annotations</artifactId>

0 commit comments

Comments
 (0)