Azure pipeline for DocFx (hosted as Azure web app), repo in GitHub #8265
RomanSebranek
started this conversation in
General
Replies: 1 comment
-
This is what I wrote some time ago, in my case the repo is in ADO and I publish to an Azure static web app, it's not the cleanest but it works, hope it helps you out trigger:
- none
pool:
vmImage: windows-latest
resources:
repositories:
- repository: dotnet-apis
type: git
name: my-dotnet-apis
stages:
- stage: 'DEV'
jobs:
- job: 'Build'
steps:
- checkout: self
fetchDepth: 1
- checkout: dotnet-apis
fetchDepth: 1
- task: NuGetCommand@2
displayName: 'Install DocFX'
inputs:
command: 'custom'
arguments: 'install docfx.console'
- task: PowerShell@2
displayName: 'List files and folders'
inputs:
targetType: 'inline'
script: Get-ChildItem -Recurse -Depth 2
- task: PowerShell@2
displayName: 'Run DocFX'
inputs:
targetType: 'inline'
script: |
$docfxDir = "docfx.console"
$project = ".\my-dotnet-apis\Microservices\Features\Features.Api\Features.Api.csproj"
$docfxMetadataDest = "$(Build.SourcesDirectory)\docfx.console\content\obj\api"
$docfxJson = ".\docfx.console\content\docfx.json"
Get-ChildItem -Path "./" -Filter "$docfxDir.*" | Rename-Item -NewName $docfxDir
Move-Item -Path ".\docfx\templates\" -Destination ".\docfx.console\content\"
.\docfx.console\tools\docfx.exe metadata $project -o $docfxMetadataDest
.\docfx.console\tools\docfx.exe $docfxJson -o .\ -t default,templates/singulinkfx
- task: PowerShell@2
displayName: 'List files and folders'
inputs:
targetType: 'inline'
script: Get-ChildItem '$(Build.SourcesDirectory)\_site'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.SourcesDirectory)\_site'
artifact: '_site'
publishLocation: 'pipeline'
- job: 'Deploy'
dependsOn: 'Build'
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: '_site'
targetPath: '$(Pipeline.Workspace)/_site'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: Get-ChildItem '$(Pipeline.Workspace)\_site' | select Mode, LastWriteTime, Length, Name
- task: AzureStaticWebApp@0
inputs:
workingDirectory: '$(Pipeline.Workspace)'
app_location: '_site'
azure_static_web_apps_api_token: '$(deployment_token)' |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, can someone help how to create Azure pipeline for DocFx, which is hosted as Azure web app resource from GitHub?
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions