Skip to content

Commit

Permalink
Update publish-csharp-apidocs.yml .NET 5->6 (#15854)
Browse files Browse the repository at this point in the history
  • Loading branch information
natke committed May 11, 2023
1 parent 1a73d61 commit 27b2815
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/publish-csharp-apidocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,38 @@ permissions:

jobs:
build:
runs-on: ubuntu-latest
env:
DOCFXVERSION: 2.62.2
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore csharp/ApiDocs/ApiDocs.csproj
- name: Download DocFX
run: |
mkdir -p build/docfx
wget https://github.com/dotnet/docfx/releases/download/v${DOCFXVERSION}/docfx-linux-x64-v${DOCFXVERSION}.zip -O build/docfx/docfx.zip
unzip build/docfx/docfx.zip -d build/docfx
mkdir -p build\docfx
Invoke-WebRequest -Uri "https://github.com/dotnet/docfx/releases/download/v${env:DOCFXVERSION}/docfx-win-x64-v${env:DOCFXVERSION}.zip" -OutFile "build/docfx/docfx.zip"
[System.IO.Compression.ZipFile]::ExtractToDirectory("build/docfx/docfx.zip", "build/docfx" )
env:
DOCFXVERSION: 2.67.0
- name: Install NuGet
uses: nuget/setup-nuget@v1
- name: Build Documentation
run: |
build/docfx/docfx metadata csharp/ApiDocs/docfx.json
dotnet build csharp/ApiDocs/ApiDocs.csproj --no-restore
build/docfx/docfx build csharp/ApiDocs/docfx.json
build\docfx\docfx metadata csharp\ApiDocs\docfx.json
dotnet build csharp\ApiDocs\ApiDocs.csproj --no-restore
build\docfx\docfx build csharp\ApiDocs\docfx.json
- name: Log source commit
run: git rev-parse --short HEAD > csharp/ApiDocs/csharp/source-version.txt
- name: Move C# docs into site
run: |
mkdir -p _site/docs/api
rm -rf _site/docs/api/csharp
mv csharp/ApiDocs/csharp _site/docs/api/csharp
mkdir _site\docs\api
if (Test-Path _site\docs\api\csharp) {
Remove-Item -Recurse -Force _site\docs\api\csharp
}
move csharp\ApiDocs\csharp _site\docs\api
- name: Upload docs artifact
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions csharp/ApiDocs/ApiDocs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion csharp/ApiDocs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
],
"dest": "api",
"disableGitFeatures": false,
"disableDefaultFilter": false
"disableDefaultFilter": false,
"properties": {
"AllowUnsafeBlocks": true,
"TargetFramework" : "net6.0",
"Nullable" : "enable"
}
}
],
"build": {
Expand Down

0 comments on commit 27b2815

Please sign in to comment.