195 строки
7.4 KiB
YAML
195 строки
7.4 KiB
YAML
pr: none
|
|
trigger: none
|
|
|
|
# Example: fluentui_20190626.1
|
|
name: 'fluentui_$(Date:yyyyMMdd)$(Rev:.r)'
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: self
|
|
type: git
|
|
ref: master
|
|
- repository: 1esPipelines
|
|
type: git
|
|
name: 1ESPipelineTemplates/1ESPipelineTemplates
|
|
ref: refs/tags/release
|
|
|
|
variables:
|
|
# below are variables that cannot be configured at queue time
|
|
- group: 'Github and NPM secrets'
|
|
- template: .devops/templates/variables.yml@self
|
|
parameters:
|
|
deployBasePath: 0.0.0-nightly
|
|
- name: docsiteVersion # used by docsite
|
|
value: 0.0.0-nightly
|
|
- name: officialRelease # used by docsite
|
|
value: true
|
|
- name: tags
|
|
value: production,externalfacing
|
|
|
|
# below are variables configurable at queue time, so they cannot appear in yml file
|
|
# - name: dryRun # set it to true in order to execute publishing in dry run mode - nothing will be published
|
|
# value: false
|
|
# - name: publishDocsiteOnly # set it to true to only run Job_build_publish_doc
|
|
# value: false
|
|
# - name: publishOfficial # set it to true to publish package to npm, and publish docsite for official releases
|
|
# value: false
|
|
|
|
extends:
|
|
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
|
|
parameters:
|
|
pool:
|
|
name: Azure-Pipelines-1ESPT-ExDShared
|
|
image: windows-latest
|
|
os: windows # We need windows because compliance task only run on windows.
|
|
stages:
|
|
- stage: main
|
|
jobs:
|
|
- job: Release
|
|
pool:
|
|
name: '1ES-Host-Ubuntu'
|
|
image: '1ES-PT-Ubuntu-20.04'
|
|
os: linux
|
|
workspace:
|
|
clean: all
|
|
displayName: Build and Release Fluent Packages
|
|
# skip this job if publishDocsiteOnly is true
|
|
condition: and(succeeded(), eq(variables.publishDocsiteOnly, false))
|
|
|
|
steps:
|
|
- template: .devops/templates/tools.yml@self
|
|
|
|
- script: |
|
|
echo "dry run mode enabled!"
|
|
displayName: dry run mode notification
|
|
condition: eq(variables.dryRun, true)
|
|
|
|
- script: |
|
|
git config user.name "Fluent UI Build"
|
|
git config user.email "fluentui-internal@service.microsoft.com"
|
|
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui.git
|
|
displayName: Authenticate git for pushes
|
|
|
|
- task: CmdLine@2
|
|
displayName: Checkout branch for version pushes
|
|
condition: and(succeeded(), eq(variables.publishOfficial, true))
|
|
inputs:
|
|
script: |
|
|
BRANCH_NAME=`echo $(Build.SourceBranch) | sed "s/refs\/heads\///"`
|
|
git checkout $BRANCH_NAME
|
|
git pull
|
|
|
|
- task: Bash@3
|
|
inputs:
|
|
filePath: yarn-ci.sh
|
|
displayName: yarn
|
|
|
|
- task: CmdLine@2
|
|
displayName: build,test,lint northstar packages
|
|
inputs:
|
|
script: |
|
|
yarn nx run-many --targets=build,test,lint,type-check,test-ssr,verify-packaging --projects='packages/fluentui/*' --nxBail
|
|
|
|
- task: CmdLine@2
|
|
displayName: '[NPM] Publish to NPM'
|
|
condition: and(succeeded(), eq(variables.publishOfficial, true))
|
|
timeoutInMinutes: 2
|
|
inputs:
|
|
script: |
|
|
NPM_TOKEN=$(npmToken)
|
|
|
|
echo "registry=https://registry.npmjs.org/" > .npmrc
|
|
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
|
|
|
|
npx northstar-release publish --dry-run $(dryRun)
|
|
|
|
git checkout -- .npmrc
|
|
|
|
- template: .devops/templates/cleanup.yml@self
|
|
|
|
- job: Release_docsite
|
|
workspace:
|
|
clean: all
|
|
displayName: Build and Publish Docsite
|
|
dependsOn: Release
|
|
pool:
|
|
name: '1ES-Host-Ubuntu'
|
|
image: '1ES-PT-Ubuntu-20.04'
|
|
os: linux
|
|
# run this job when the previous job is succeeded or when publishDocsiteOnly is true
|
|
condition: and(eq(variables.dryRun, false), or(succeeded(), eq(variables.publishDocsiteOnly, true)))
|
|
|
|
steps:
|
|
- template: .devops/templates/tools.yml@self
|
|
|
|
- script: |
|
|
echo "dry run mode enabled!"
|
|
displayName: dry run mode notification
|
|
condition: eq(variables.dryRun, true)
|
|
|
|
- task: CmdLine@2
|
|
displayName: Checkout branch for pull
|
|
condition: and(succeeded(), eq(variables.publishOfficial, true))
|
|
inputs:
|
|
script: |
|
|
BRANCH_NAME=`echo $(Build.SourceBranch) | sed "s/refs\/heads\///"`
|
|
git checkout $BRANCH_NAME
|
|
git pull
|
|
|
|
- task: Bash@3
|
|
displayName: Yarn
|
|
inputs:
|
|
filePath: yarn-ci.sh
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Set base path and version'
|
|
condition: and(succeeded(), eq(variables.publishOfficial, true))
|
|
inputs:
|
|
script: |
|
|
ver=`node -p "require('./packages/fluentui/react-northstar/package.json').version"`
|
|
echo "Docsite base path published for version $ver"
|
|
echo "##vso[task.setvariable variable=deployBasePath]$ver"
|
|
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
|
|
|
|
- task: CmdLine@2
|
|
displayName: Build
|
|
inputs:
|
|
script: |
|
|
echo deployBasePath $(deployBasePath) docsiteVersion $(docsiteVersion)
|
|
NODE_ENV=production yarn nx run docs:bundle
|
|
|
|
- task: AzureCLI@2
|
|
displayName: Upload to Azure
|
|
inputs:
|
|
azureSubscription: 'Azure - fluentsite storage - NEW'
|
|
scriptType: 'bash'
|
|
scriptLocation: 'inlineScript'
|
|
inlineScript: |
|
|
az storage blob upload-batch \
|
|
--destination '$web' \
|
|
--source packages/fluentui/docs/dist \
|
|
--account-name fluentsite \
|
|
--destination-path $(deployBasePath) \
|
|
--auth-mode login \
|
|
--overwrite
|
|
|
|
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
|
displayName: 📒 Generate Manifest Docsite
|
|
inputs:
|
|
BuildDropPath: $(System.DefaultWorkingDirectory)
|
|
|
|
# Publish the manifest to a separate artifact to avoid hosting the _manifest files on the website
|
|
- task: 1ES.PublishPipelineArtifact@1
|
|
displayName: 📒 Publish Manifest DocSite
|
|
inputs:
|
|
artifactName: SBom-DocSite-$(System.JobAttempt)
|
|
targetPath: $(System.DefaultWorkingDirectory)/_manifest
|
|
|
|
- task: 1ES.PublishPipelineArtifact@1
|
|
displayName: Publish Docsite as Pipeline Artifact
|
|
inputs:
|
|
path: packages/fluentui/docs/dist
|
|
artifactName: docsite_v$(docsiteVersion)
|
|
|
|
- template: .devops/templates/cleanup.yml@self
|