|
71 | 71 | run: | |
72 | 72 | az logout |
73 | 73 | if: always() |
| 74 | + |
| 75 | + # This job updates the Azure (APIM) API with the OpenAPI definition file |
| 76 | + # coming from the Azure Function |
| 77 | + update-api: |
| 78 | + needs: build-and-deploy |
| 79 | + if: inputs.update_api |
| 80 | + # The type of runner that the job will run on |
| 81 | + runs-on: ubuntu-latest |
| 82 | + |
| 83 | + # Functions configurations |
| 84 | + strategy: |
| 85 | + matrix: |
| 86 | + include: |
| 87 | + - azure_api_id: 'liquid-api' |
| 88 | + azure_api_path: '/liquid' |
| 89 | + azure_api_name: 'Liquid API' |
| 90 | + azure_api_spec_url: 'https://fn-liquid-dev.azurewebsites.net/api/openapi/v3.json' |
| 91 | + - azure_api_id: 'solid-api' |
| 92 | + azure_api_path: '/solid' |
| 93 | + azure_api_name: 'Solid API' |
| 94 | + azure_api_spec_url: 'https://fn-solid-dev.azurewebsites.net/api/openapi/v3.json' |
| 95 | + - azure_api_id: 'solidud-api' |
| 96 | + azure_api_path: '/solidus' |
| 97 | + azure_api_name: 'Solidus API' |
| 98 | + azure_api_spec_url: 'https://fn-solidus-dev.azurewebsites.net/api/openapi/v3.json' |
| 99 | + |
| 100 | + # Azure API Import configuration (optional) |
| 101 | + env: |
| 102 | + AZURE_RG: ${{ secrets.AZURE_RESOURCE_GROUP }} # Resource group name |
| 103 | + AZURE_API_SERVICE: ${{ secrets.AZURE_API_MANAGER }} # API Manager ID |
| 104 | + AZURE_API_ID: ${{ matrix.azure_api_id }} |
| 105 | + AZURE_API_PATH: ${{ matrix.azure_api_path }} |
| 106 | + AZURE_API_NAME: ${{ matrix.azure_api_name }} |
| 107 | + AZURE_API_SPEC_URL: ${{ matrix.azure_api_spec_url }} |
| 108 | + |
| 109 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 110 | + steps: |
| 111 | + # Login to Azure using secrets credentials |
| 112 | + - name: 'Login via Azure CLI' |
| 113 | + uses: azure/login@v1 |
| 114 | + with: |
| 115 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 116 | + |
| 117 | + # Run Azure CLI command to import an API definition from an OpenID definition file |
| 118 | + - name: Run Azure API Import (CLI) |
| 119 | + run: | |
| 120 | + az apim api import --path $AZURE_API_PATH --api-id $AZURE_API_ID -g $AZURE_RG -n $AZURE_API_SERVICE --display-name "$AZURE_API_NAME" --specification-url "$AZURE_API_SPEC_URL" --specification-format OpenAPI --protocols https |
| 121 | + |
| 122 | + # Azure logout |
| 123 | + - name: logout |
| 124 | + run: | |
| 125 | + az logout |
| 126 | + if: always() |
0 commit comments