ForresterDemo/.github/workflows/ToyotaFunctionApp2021072714...

49 строки
2.2 KiB
YAML

name: Build and deploy .NET Core application to Function App ToyotaFunctionApp20210727144805 with API Management Service ToyotaFunctionAppapi-ToyotaFunctionApp
on:
push:
branches:
- main
env:
AZURE_FUNCTIONAPP_NAME: ToyotaFunctionApp20210727144805
AZURE_FUNCTIONAPP_PACKAGE_PATH: ToyotaFunctionApp\.
CONFIGURATION: Release
DOTNET_CORE_VERSION: 3.1.x
WORKING_DIRECTORY: ToyotaFunctionApp
DOTNET_CORE_VERSION_INPROC: ''
AZURE_APIM_RESOURCEGROUP: ToyotaLogistics
AZURE_APIM_SERVICENAME: ToyotaFunctionAppapi
AZURE_APIM_API_ID: ToyotaFunctionApp
AZURE_APIM_RESOURCE_PATH: /
AZURE_APIM_SWAGGERURL: https://toyotafunctionapp20210727144805.azurewebsites.net/api/swagger.json
jobs:
build-and-deploy:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Setup .NET Core (for inproc extensions)
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION_INPROC }}
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}"
- name: Deploy to Azure Function App
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
publish-profile: ${{ secrets.TOYOTAFUNCTIONAPP20210727144805_FFFF }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.ToyotaFunctionAppapi_SPN }}
- name: Import API into Azure API Management
run: az apim api import --path "${{ env.AZURE_APIM_RESOURCE_PATH }}" --resource-group ${{ env.AZURE_APIM_RESOURCEGROUP }} --service-name ${{ env.AZURE_APIM_SERVICENAME }} --api-id ${{ env.AZURE_APIM_API_ID }} --specification-url "${{ env.AZURE_APIM_SWAGGERURL }}" --specification-format OpenApi --subscription-required false