Automated commit 'Merge pull request #1896 from sailpoint/devrel-1882 #492
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build and push typescript sdk" | |
env: | |
SAIL_CLIENT_ID: ${{ secrets.SDK_TEST_TENANT_CLIENT_ID }} | |
SAIL_CLIENT_SECRET: ${{ secrets.SDK_TEST_TENANT_CLIENT_SECRET }} | |
SAIL_BASE_URL: ${{ secrets.SDK_TEST_TENANT_BASE_URL }} | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- idn/** | |
workflow_dispatch: | |
jobs: | |
push_typescript_sdk_workflow: | |
name: Build and push typescript SDK | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the master branch request to run rsync | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
# Checkout the main branch of api-specs | |
- name: Checkout API Specs Repo | |
uses: actions/checkout@v3 | |
with: | |
repository: sailpoint-oss/typescript-sdk | |
path: sdk-ts | |
ref: main | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Build V3 SDK | |
id: buildV3 | |
run: | | |
cd sdk-ts | |
rm -rf sdk-output/v3 | |
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.v3.yaml -g typescript-axios -o sdk-output/v3 --global-property skipFormModel=false --config sdk-resources/v3-config.yaml | |
- name: Build Beta SDK | |
id: buildBeta | |
if: steps.buildV3.outcome == 'success' | |
run: | | |
cd sdk-ts | |
rm -rf sdk-output/beta | |
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.beta.yaml -g typescript-axios -o sdk-output/beta --global-property skipFormModel=false --config sdk-resources/beta-config.yaml --api-name-suffix BetaApi --model-name-suffix Beta | |
- name: Build V2024 SDK | |
id: buildV2024 | |
if: steps.buildBeta.outcome == 'success' | |
run: | | |
cd sdk-ts | |
rm -rf sdk-output/v2024 | |
node sdk-resources/prescript.js ../idn/v2024/paths | |
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.v2024.yaml -g typescript-axios -o sdk-output/v2024 --global-property skipFormModel=false --config sdk-resources/v2024-config.yaml --api-name-suffix V2024Api --model-name-suffix V2024 | |
- name: Run npm install and build Typescript SDK | |
id: buildSDK | |
if: steps.buildBeta.outcome == 'success' | |
run: | | |
cd sdk-ts/sdk-output | |
npm install | |
npm run build | |
npm run test | |
- name: After SDK Build | |
if: steps.buildSDK.outcome == 'success' | |
run: | | |
cd sdk-ts | |
git config --unset-all http.https://github.com/.extraheader | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action Bot" | |
if git status --porcelain | grep -q .; then | |
# Changes are present | |
git add . | |
git commit -m "Automated build '${{ github.event.head_commit.message }}' typescript-axios sdk: ${{ github.run_id }}" | |
git remote set-url origin https://${{secrets.DEVREL_SERVICE_TOKEN}}@github.com/sailpoint-oss/typescript-sdk.git | |
git remote -v | |
git push | |
else | |
# No changes are present | |
echo "No changes to commit" | |
fi | |
push_typescript_sdk_workflow-failure: | |
runs-on: ubuntu-latest | |
if: ${{ always() && (needs.push_typescript_sdk_workflow.result == 'failure' || needs.push_typescript_sdk_workflow.result == 'timed_out') }} | |
needs: | |
- push_typescript_sdk_workflow | |
steps: | |
- name: Invoke GithubNotificationsFunction Lambda | |
run: | | |
curl -X POST \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"workflowName": "${{ github.job }}", | |
"repositoryName": "${{ github.event.repository.name }}", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
}' \ | |
"${{ secrets.NOTIFICATIONS_FUNCTION_URL }}" |