-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (55 loc) · 1.73 KB
/
run-examples.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
name: Run Examples
on:
workflow_call:
inputs:
jdk:
description: 'JDK version to use'
required: true
type: string
distribution:
description: 'JDK distribution to use'
required: false
type: string
default: 'corretto'
branch:
description: 'Branch to build SDK and run examples from'
required: true
type: string
jobs:
run-examples:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: 'ExpediaGroup/rapid-java-sdk'
ref: ${{ inputs.branch }}
path: sdk-repo
- name: Parse SDK version
id: parse-sdk-version
working-directory: sdk-repo/code
shell: python -u {0}
run: |
import os
import xml.etree.ElementTree as ET
tree = ET.parse("pom.xml")
root = tree.getroot()
version = root.find("{*}version").text
with open(os.getenv("GITHUB_OUTPUT"), "a") as GITHUB_OUTPUT:
print(f"version={version}", file=GITHUB_OUTPUT)
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.jdk }}
distribution: ${{ inputs.distribution }}
- name: Install SDK
working-directory: sdk-repo/code
run: |
mvn clean install
- name: Run Examples
working-directory: sdk-repo/examples
run: |
mvn install exec:java \
-Drapid-java-sdk.sdk.version="${{ steps.parse-sdk-version.outputs.version }}" \
-Dcom.expediagroup.rapidsdkjava.apikey="${{ secrets.KEY }}" \
-Dcom.expediagroup.rapidsdkjava.apisecret="${{ secrets.SECRET }}"