|
| 1 | +name: "Build Proxies" |
| 2 | +description: "Build Proxies" |
| 3 | + |
| 4 | +inputs: |
| 5 | + apimEnv: |
| 6 | + description: "APIM environment" |
| 7 | + required: true |
| 8 | + buildSandbox: |
| 9 | + description: "Whether to build the sandbox OAS spec" |
| 10 | + required: false |
| 11 | + default: false |
| 12 | + nodejs_version: |
| 13 | + description: "Node.js version, set by the CI/CD pipeline workflow" |
| 14 | + required: true |
| 15 | + NODE_AUTH_TOKEN: |
| 16 | + description: "Token for access to github package registry" |
| 17 | + required: true |
| 18 | + |
| 19 | +runs: |
| 20 | + using: composite |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: ${{ inputs.nodejs_version }} |
| 28 | + registry-url: 'https://npm.pkg.github.com' |
| 29 | + |
| 30 | + - name: "Cache node_modules" |
| 31 | + uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: | |
| 34 | + **/node_modules |
| 35 | + key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }} |
| 36 | + restore-keys: | |
| 37 | + ${{ runner.os }}-node-${{ inputs.nodejs_version }}- |
| 38 | +
|
| 39 | + - name: Npm install |
| 40 | + working-directory: . |
| 41 | + env: |
| 42 | + NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }} |
| 43 | + run: npm ci |
| 44 | + shell: bash |
| 45 | + |
| 46 | + - name: Build ${{ inputs.apimEnv }} oas |
| 47 | + working-directory: . |
| 48 | + env: |
| 49 | + APIM_ENV: ${{ inputs.apimEnv }} |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + if [ ${{ env.APIM_ENV }} == "internal-dev-sandbox" ] && [ ${{ inputs.buildSandbox }} == true ] |
| 53 | + then |
| 54 | + echo "Building sandbox OAS spec" |
| 55 | + make build-json-oas-spec APIM_ENV=sandbox |
| 56 | + else |
| 57 | + echo "Building env specific OAS spec" |
| 58 | + make build-json-oas-spec APIM_ENV=${{ env.APIM_ENV }} |
| 59 | + fi |
| 60 | +
|
| 61 | + if [[ $APIM_ENV == *-pr ]]; then |
| 62 | + echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen" |
| 63 | + APIM_ENV=$(echo "$APIM_ENV" | sed 's/-pr$//') |
| 64 | + fi |
| 65 | + echo "APIM_ENV=$APIM_ENV" >> $GITHUB_ENV |
| 66 | +
|
| 67 | + - name: Upload OAS Spec |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: ${{ env.APIM_ENV }}-build-output |
| 71 | + path: ./build |
0 commit comments