Skip to content

Support Azure Functions v4 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,31 @@ on:
branches: [ master ]

env:
DOTNET_VERSION: 3.1.x
DOTNET_VERSION: 6.0.x
DOTNETCORE_VERSION: 3.1.x

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use .NET Core ${{ env.DOTNET_VERSION }}
- name: Use .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
include-prerelease: true

- name: Install .NET Core format tool
- name: Use .NET Core ${{ env.DOTNETCORE_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNETCORE_VERSION }}

- name: Install .NET format tool
run: dotnet tool update -g dotnet-format

- name: Build project
run: dotnet build -c Release

- name: Lint C# code
run: dotnet format --check --verbosity detailed
run: dotnet format --verify-no-changes --verbosity detailed --no-restore
11 changes: 9 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ on:
tags: [ v* ]

env:
DOTNET_VERSION: 3.1.x
DOTNET_VERSION: 6.0.x
DOTNETCORE_VERSION: 3.1.x

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use .NET Core ${{ env.DOTNET_VERSION }}
- name: Use .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
include-prerelease: true

- name: Use .NET Core ${{ env.DOTNETCORE_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNETCORE_VERSION }}

- name: Setup Version
id: setup_version
Expand Down
6 changes: 3 additions & 3 deletions samples/BasicSample/BasicSample.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Azure.WebJobs.Extensions.HttpApi\Azure.WebJobs.Extensions.HttpApi.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions samples/VirtualPathSample/VirtualPathSample.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Azure.WebJobs.Extensions.HttpApi\Azure.WebJobs.Extensions.HttpApi.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<Authors>shibayan</Authors>
<Description>HTTP API Extensions for Azure Functions</Description>
<PackageId>WebJobs.Extensions.HttpApi</PackageId>
<Description>HTTP API Extensions for Azure Functions v3</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>https://github.com/shibayan/azure-functions-http-api/releases</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
6 changes: 2 additions & 4 deletions src/Azure.WebJobs.Extensions.HttpApi/FunctionEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ namespace Azure.WebJobs.Extensions.HttpApi
{
internal static class FunctionEnvironment
{
public static bool IsAvailable
=> !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"));
public static bool IsAvailable => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"));

public static string RootPath
=> IsAvailable ? Environment.ExpandEnvironmentVariables($"%HOME%/site/wwwroot") : Environment.CurrentDirectory;
public static string RootPath => IsAvailable ? Environment.ExpandEnvironmentVariables($"%HOME%/site/wwwroot") : Environment.CurrentDirectory;
}
}