diff --git a/build/azure-pipelines-docs-next.yml b/build/azure-pipelines-docs-next.yml index 7a856f49..ed524bf6 100644 --- a/build/azure-pipelines-docs-next.yml +++ b/build/azure-pipelines-docs-next.yml @@ -1,21 +1,103 @@ -# Node.js -# Build a general Node.js project with npm. -# Add steps that analyze code, save build artifacts, deploy, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript - trigger: -- main + branches: + include: + - main + +pr: + branches: + include: + - main + +resources: + repositories: + - repository: self + type: git + ref: main + # - repository: contributionRepo + # type: github + # name: SuperOfficeDocs/contribution + # ref: main # always pull main, adjust if needed + # - repository: superofficeDocsRepo + # type: github + # name: SuperOfficeDocs/superoffice-docs + # ref: main + +stages: + - stage: Build + displayName: "Build and Package" + jobs: + - job: Build + displayName: "Build .NET + Astro frontend" + pool: + name: Default # Uses Agent Pool named 'Default' + demands: + - agent.os -equals Linux + steps: + # Checkout your main repo + - checkout: self + + # Checkout external repos + - script: | + git clone https://github.com/SuperOfficeDocs/contribution.git ClientApp/external-content/contribution + git clone https://github.com/SuperOfficeDocs/superoffice-docs.git ClientApp/external-content/superoffice-docs + displayName: "Clone external GitHub repos" + + # Install .NET SDK + - task: UseDotNet@2 + inputs: + packageType: 'sdk' + version: '8.x' + + # Install Node.js + - task: NodeTool@0 + inputs: + versionSpec: '22.x' + + # Build & publish the .NET project (includes front-end build if wired in MSBuild targets) + - script: | + cd Server + dotnet publish -c Release -o $(Build.ArtifactStagingDirectory)/out + displayName: "Publish .NET & Astro project" + + # Zip the published output + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/out' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/app.zip' + replaceExistingArchive: true + + # Publish the zip as a pipeline artifact + - publish: $(Build.ArtifactStagingDirectory)/app.zip + artifact: docs-nect-artifact + + # - stage: Deploy + # displayName: "Deploy to Azure Web App" + # dependsOn: Build + # condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), + # eq(variables['Build.Reason'], 'Manual')) + # jobs: + # - deployment: DeployJob + # environment: 'production' + # pool: + # vmImage: 'ubuntu-latest' + # strategy: + # runOnce: + # deploy: + # steps: + # # Download artifact from Build stage + # - download: current + # artifact: docs-nect-artifact + + # # Deploy the artifact to Azure App Service + # - task: AzureWebApp@1 + # displayName: "Deploy ZIP to Azure Web App" + # inputs: + # azureSubscription: '' # ARM service connection in DevOps + # appName: 'docs-next' # Azure App Service name + # package: '$(Pipeline.Workspace)/drop/app.zip' + # appType: 'webAppLinux' -pool: - vmImage: ubuntu-latest -steps: -- task: NodeTool@0 - inputs: - versionSpec: '20.x' - displayName: 'Install Node.js' -- script: | - npm install - npm run build - displayName: 'npm install and build'