diff --git a/.github/workflows/ToyotaLogisticsSystem2.yml b/.github/workflows/ToyotaLogisticsSystem2.yml new file mode 100644 index 0000000..b385c46 --- /dev/null +++ b/.github/workflows/ToyotaLogisticsSystem2.yml @@ -0,0 +1,43 @@ +name: Build and deploy .NET Core application to Function App ToyotaLogisticsSystem2 with API Management Service ToyotaLogisticsSystem2-ToyotaLogisticsSystem2 +on: + push: + branches: + - main +env: + AZURE_FUNCTIONAPP_NAME: ToyotaLogisticsSystem2 + AZURE_FUNCTIONAPP_PACKAGE_PATH: ToyotaFunctionApp/publish + CONFIGURATION: Release + DOTNET_CORE_VERSION: 3.1.x + WORKING_DIRECTORY: ToyotaFunctionApp + AZURE_APIM_RESOURCEGROUP: ToyotaLogistics + AZURE_APIM_SERVICENAME: ToyotaLogisticsSystem2 + AZURE_APIM_API_ID: ToyotaLogisticsSystem2 + AZURE_APIM_RESOURCE_PATH: / + AZURE_APIM_SWAGGERURL: https://toyotalogisticssystem2.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: 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.ToyotaLogisticsSystem2_1792 }} + package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} + - name: Azure Login + uses: azure/login@v1 + with: + creds: ${{ secrets.ToyotaLogisticsSystem2_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 diff --git a/ToyotaFunctionApp/ToyotaFunctionApp/ToyotaGetVehicleRequest.cs b/ToyotaFunctionApp/ToyotaFunctionApp/ToyotaGetVehicleRequest.cs index d24ee9d..b4fb0d2 100644 --- a/ToyotaFunctionApp/ToyotaFunctionApp/ToyotaGetVehicleRequest.cs +++ b/ToyotaFunctionApp/ToyotaFunctionApp/ToyotaGetVehicleRequest.cs @@ -26,6 +26,8 @@ namespace ToyotaFunctionApp public static async Task GetVehicleRequest( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, ILogger log) + + //this is the http trigger { log.LogInformation("C# HTTP trigger function processed a request.");