@@ -20,6 +20,9 @@ inputs:
2020 proxygen_url :
2121 description : ' Proxygen API URL'
2222 required : true
23+ version_tag :
24+ description : ' Version applied to the deployed proxy'
25+ required : false
2326
2427outputs :
2528 deployment_status :
3639 pip install pyyaml
3740
3841 - name : Validate workspace format
42+ if : ${{ !contains(inputs.apim_env, 'sandbox') }}
3943 shell : bash
4044 run : |
4145 if [[ ! "${{ inputs.workspace }}" =~ ^ftrs-[0-9]+$ ]]; then
4549 echo "Workspace format validated: ${{ inputs.workspace }}"
4650
4751 - name : Modify OAS Specification
52+ if : ${{ !contains(inputs.apim_env, 'sandbox') }}
4853 id : modify-spec
4954 shell : bash
5055 run : |
6368 exit 1
6469 fi
6570
71+ - name : Modify Sandbox OAS Specification
72+ if : ${{ contains(inputs.apim_env, 'sandbox') }}
73+ id : modify-sandbox-spec
74+ shell : bash
75+ run : |
76+ export API_NAME="${{ inputs.api_name }}"
77+ export PROXY_ENV="${{ inputs.apim_env }}"
78+ export VERSION_TAG="${{ inputs.version_tag }}"
79+
80+ chmod +x ./scripts/workflow/modify-oas-sandbox-spec.sh
81+ read -r MODIFIED_SPEC_PATH TARGET_SPEC_FILE < <(./scripts/workflow/modify-oas-sandbox-spec.sh)
82+
83+ if [ $? -eq 0 ]; then
84+ echo "modified_spec_path=$MODIFIED_SPEC_PATH" >> $GITHUB_OUTPUT
85+ echo "target_spec_file_abs=$TARGET_SPEC_FILE" >> $GITHUB_OUTPUT
86+ echo "OAS spec modified successfully"
87+ else
88+ echo "Failed to modify OAS spec"
89+ exit 1
90+ fi
91+
6692 - name : Deploy API Proxy to APIM environment
6793 id : deploy
6894 shell : bash
7197 export WORKSPACE="${{ inputs.workspace }}"
7298 export PROXY_ENV="${{ inputs.apim_env }}"
7399 export ACCESS_TOKEN="${{ inputs.access_token }}"
74- export MODIFIED_SPEC_PATH="${{ steps.modify-spec.outputs.modified_spec_path }}"
75100 export PROXYGEN_URL="${{ inputs.proxygen_url }}"
101+ export VERSION_TAG="${{ inputs.version_tag }}"
102+ export IS_SANDBOX="${{ contains(inputs.apim_env, 'sandbox') }}"
103+
104+ if [[ "$IS_SANDBOX" == 'true' ]]; then
105+ export MODIFIED_SPEC_PATH="${{ steps.modify-sandbox-spec.outputs.modified_spec_path }}"
106+ export TARGET_SPEC_FILE="${{ steps.modify-sandbox-spec.outputs.target_spec_file_abs }}"
107+ else
108+ export MODIFIED_SPEC_PATH="${{ steps.modify-spec.outputs.modified_spec_path }}"
109+ fi
76110
77111 chmod +x ./scripts/workflow/deploy-to-apim.sh
78112 ./scripts/workflow/deploy-to-apim.sh
@@ -89,9 +123,13 @@ runs:
89123 - name : Output deployment details
90124 shell : bash
91125 run : |
126+ VERSION_TAG="${{ inputs.version_tag }}"
92127 echo "Deployment Summary:"
93128 echo "- API Name: ${{ inputs.api_name }}"
94129 echo "- Workspace: ${{ inputs.workspace }}"
95130 echo "- Environment: ${{ inputs.environment }}"
96131 echo "- APIM Environment: ${{inputs.apim_env }}"
132+ if [ -n "$VERSION_TAG" ]; then
133+ echo "- Version Tag: $VERSION_TAG"
134+ fi
97135 echo "- Status: ${{ steps.deploy.outputs.status }}"
0 commit comments