-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (34 loc) · 1.71 KB
/
register-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Register API Definition to Azure API Center
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
# Please configure the environment name required in federated identity credential
# https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#creating-an-environment
# environment: production
steps:
- uses: actions/checkout@v2
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-azure
# https://github.com/marketplace/actions/azure-login#login-with-openid-connect-oidc-recommended
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
# Please create following environment variables to deploy to azure resource: RESOURCE_GROUP, RESOURCE_NAME, FILE_LOCATION
# RESOURCE_GROUP: Azure Resource Group name, please ensure the resource group already created.
# RESOURCE_NAME: Azure API Center resource name, please ensure the API Center resource already created.
# FILE_LOCATION: API Definition file location
# https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository
- name: Deploy to API Center
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az apic api register -g ${{ vars.RESOURCE_GROUP }} -s ${{ vars.RESOURCE_NAME }} --api-location ${{ vars.FILE_LOCATION }}