|
| 1 | +pr: none |
| 2 | +trigger: none |
| 3 | + |
| 4 | +parameters: |
| 5 | + - name: dryRun |
| 6 | + displayName: Dry Run Mode |
| 7 | + type: boolean |
| 8 | + default: true |
| 9 | + |
| 10 | +# Customize build number to include tools experimental prefix |
| 11 | +# Example: tools_experimental_20201022.1 |
| 12 | +name: 'tools_experimental_$(Date:yyyyMMdd)$(Rev:.r)' |
| 13 | + |
| 14 | +variables: |
| 15 | + - group: 'Github and NPM secrets' |
| 16 | + - template: .devops/templates/variables.yml |
| 17 | + parameters: |
| 18 | + skipComponentGovernanceDetection: false |
| 19 | + - name: tags |
| 20 | + value: production,externalfacing |
| 21 | + |
| 22 | +resources: |
| 23 | + repositories: |
| 24 | + - repository: 1esPipelines |
| 25 | + type: git |
| 26 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 27 | + ref: refs/tags/release |
| 28 | + |
| 29 | +extends: |
| 30 | + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines |
| 31 | + parameters: |
| 32 | + pool: |
| 33 | + name: Azure-Pipelines-1ESPT-ExDShared |
| 34 | + image: windows-latest |
| 35 | + os: windows # We need windows because compliance task only run on windows. |
| 36 | + stages: |
| 37 | + - stage: main |
| 38 | + jobs: |
| 39 | + - job: Release |
| 40 | + pool: |
| 41 | + name: '1ES-Host-Ubuntu' |
| 42 | + image: '1ES-PT-Ubuntu-20.04' |
| 43 | + os: linux |
| 44 | + timeoutInMinutes: 90 |
| 45 | + workspace: |
| 46 | + clean: all |
| 47 | + templateContext: |
| 48 | + outputParentDirectory: $(System.DefaultWorkingDirectory) |
| 49 | + outputs: |
| 50 | + - output: pipelineArtifact |
| 51 | + targetPath: $(System.DefaultWorkingDirectory) |
| 52 | + artifactName: output |
| 53 | + steps: |
| 54 | + - template: .devops/templates/tools.yml@self |
| 55 | + parameters: |
| 56 | + dryRun: ${{ parameters.dryRun }} |
| 57 | + |
| 58 | + - script: | |
| 59 | + git config user.name "Fluent UI Build" |
| 60 | + git config user.email "fluentui-internal@service.microsoft.com" |
| 61 | + displayName: Configure git user (used by beachball) |
| 62 | +
|
| 63 | + - task: Bash@3 |
| 64 | + name: validation |
| 65 | + inputs: |
| 66 | + targetType: 'inline' |
| 67 | + script: | |
| 68 | + BRANCH="$(Build.SourceBranch)" |
| 69 | + if [[ ! $BRANCH =~ refs/heads/experimental/ ]]; then |
| 70 | + echo "##vso[task.logissue type=error]Branch '$BRANCH' must start with 'refs/heads/experimental/'" |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + BRANCH_PATH=${BRANCH#refs/heads/} |
| 74 | + FEATURE_NAME=${BRANCH#refs/heads/experimental/} |
| 75 | + echo "##vso[task.setvariable variable=branchPath;isOutput=true]$BRANCH_PATH" |
| 76 | + echo "##vso[task.setvariable variable=featureName;isOutput=true]$FEATURE_NAME" |
| 77 | + echo "Branch path: $BRANCH_PATH" |
| 78 | + echo "Feature name: $FEATURE_NAME" |
| 79 | + displayName: Validate branch and extract feature name |
| 80 | + |
| 81 | + - script: | |
| 82 | + yarn install --frozen-lockfile |
| 83 | + displayName: Install dependencies |
| 84 | +
|
| 85 | + # Deletes all existing changefiles so that only bump that happens is for experimental |
| 86 | + - script: | |
| 87 | + rm -f change/* |
| 88 | + displayName: 'Delete existing changefiles' |
| 89 | +
|
| 90 | + # Bumps all tools packages to x.x.x-experimental.<feature>.<date>-<hash> version |
| 91 | + # x.x.x is each package's own current version |
| 92 | + - script: | |
| 93 | + FEATURE_NAME=$(validation.featureName) |
| 94 | + DATE=$(date +"%Y%m%d") |
| 95 | + HASH=$(git rev-parse --short HEAD) |
| 96 | + VERSION_SUFFIX="experimental.${FEATURE_NAME}.${DATE}-${HASH}" |
| 97 | +
|
| 98 | + echo "Version suffix: ${VERSION_SUFFIX}" |
| 99 | +
|
| 100 | + yarn nx g @fluentui/workspace-plugin:version-bump --all --scope tools --versionSuffix "${VERSION_SUFFIX}" |
| 101 | + git add . |
| 102 | + git commit -m "bump tools experimental versions with suffix ${VERSION_SUFFIX}" |
| 103 | + yarn change --type prerelease --message "Release experimental tools ${VERSION_SUFFIX}" --dependent-change-type "prerelease" |
| 104 | + displayName: 'Bump and commit experimental versions' |
| 105 | +
|
| 106 | + - script: | |
| 107 | + FLUENT_PROD_BUILD=true yarn nx run-many -t build -p 'tag:tools,!tag:npm:private,!tag:v8' --exclude 'apps/**' --nxBail |
| 108 | + displayName: build |
| 109 | +
|
| 110 | + - script: | |
| 111 | + FLUENT_PROD_BUILD=true yarn nx run-many -t lint -p 'tag:tools,!tag:npm:private,!tag:v8' --exclude 'apps/**' --nxBail |
| 112 | + displayName: lint |
| 113 | +
|
| 114 | + - script: | |
| 115 | + FLUENT_PROD_BUILD=true yarn nx run-many -t test -p 'tag:tools,!tag:npm:private,!tag:v8' --exclude 'apps/**' --nxBail |
| 116 | + displayName: test |
| 117 | +
|
| 118 | + - script: | |
| 119 | + yarn beachball publish -b origin/$(validation.branchPath) --access public -y -n $(npmToken) --no-push --tag experimental --config scripts/beachball/src/release-tools.config.js |
| 120 | + git reset --hard origin/$(validation.branchPath) |
| 121 | + displayName: Publish changes and bump versions |
| 122 | + condition: and(succeeded(), not(${{ parameters.dryRun }})) |
| 123 | +
|
| 124 | + - template: .devops/templates/cleanup.yml@self |
| 125 | + parameters: |
| 126 | + checkForModifiedFiles: false |
0 commit comments