|
| 1 | +name: Run Examples |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + sdk_version: |
| 6 | + description: 'SDK version to run examples for' |
| 7 | + required: false |
| 8 | + type: string |
| 9 | + default: 'LATEST' |
| 10 | + jdk: |
| 11 | + description: 'JDK version to use' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + default: '21' |
| 15 | + distribution: |
| 16 | + description: 'JDK distribution to use' |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + default: 'corretto' |
| 20 | + sdk_generation_workflow_run_id: |
| 21 | + description: 'ID of the SDK generation workflow run' |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + default: '' |
| 25 | + secrets: |
| 26 | + KEY: |
| 27 | + description: 'API Key' |
| 28 | + required: true |
| 29 | + SECRET: |
| 30 | + description: 'API Key' |
| 31 | + required: true |
| 32 | + |
| 33 | +jobs: |
| 34 | + run-examples: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 39 | + with: |
| 40 | + repository: 'ExpediaGroup/rapid-java-sdk' |
| 41 | + - uses: dawidd6/action-download-artifact@v6 |
| 42 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 43 | + with: |
| 44 | + run_id: ${{ inputs.sdk_generation_workflow_run_id }} |
| 45 | + name: jar |
| 46 | + path: examples/jar |
| 47 | + - uses: dawidd6/action-download-artifact@v6 |
| 48 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 49 | + with: |
| 50 | + run_id: ${{ inputs.sdk_generation_workflow_run_id }} |
| 51 | + name: sdk |
| 52 | + path: examples/sdk |
| 53 | + - name: Set up JDK |
| 54 | + uses: actions/setup-java@v4 |
| 55 | + with: |
| 56 | + java-version: ${{ inputs.jdk }} |
| 57 | + distribution: ${{ inputs.distribution }} |
| 58 | + - name: Extract POM from JAR |
| 59 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 60 | + working-directory: examples |
| 61 | + run: unzip -o jar/original-rapid-sdk-${{ inputs.sdk_version }}.jar -d jar/extracted |
| 62 | + - name: Overwrite SDK POM file |
| 63 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 64 | + working-directory: examples |
| 65 | + run: mv jar/extracted/META-INF/maven/com.expediagroup/rapid-sdk/pom.xml sdk/pom.xml |
| 66 | + - name: Install SDK into local repository |
| 67 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 68 | + working-directory: examples/sdk |
| 69 | + run: mvn install |
| 70 | + - name: Install SDK Jar |
| 71 | + if: ${{ inputs.sdk_generation_workflow_run_id != '' }} |
| 72 | + working-directory: examples |
| 73 | + run: mvn install && mvn install:install-file -Dfile=jar/rapid-sdk-${{ inputs.sdk_version }}.jar -DartifactId=rapid-sdk -DgroupId=com.expediagroup -Dversion=${{ inputs.sdk_version }} -Dpackaging=jar |
| 74 | + - name: Run Examples |
| 75 | + working-directory: examples |
| 76 | + run: mvn install exec:java -Drapid-java-sdk.sdk.version="${{ inputs.sdk_version }}" -Dcom.expediagroup.rapidsdkjava.apikey="${{ secrets.KEY }}" -Dcom.expediagroup.rapidsdkjava.apisecret="${{ secrets.SECRET }}" |
0 commit comments