|
| 1 | +# Release Pipeline - Build, Test, and Release |
| 2 | +# This pipeline will be extended to the OneESPT template |
| 3 | +trigger: none |
| 4 | +resources: |
| 5 | + repositories: |
| 6 | + - repository: 1ESPipelineTemplates |
| 7 | + type: git |
| 8 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 9 | + ref: refs/tags/release |
| 10 | +extends: |
| 11 | + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates |
| 12 | + parameters: |
| 13 | + sdl: |
| 14 | + sbom: |
| 15 | + enabled: false |
| 16 | + sourceAnalysisPool: |
| 17 | + name: 1ES-ABTT-Shared-Pool |
| 18 | + image: abtt-windows-2022 |
| 19 | + os: windows |
| 20 | + pool: |
| 21 | + name: 1ES-ABTT-Shared-Pool |
| 22 | + image: abtt-ubuntu-2204 |
| 23 | + os: linux |
| 24 | + customBuildTags: |
| 25 | + - ES365AIMigrationTooling |
| 26 | + stages: |
| 27 | + - stage: Build |
| 28 | + displayName: Build and Prerelease |
| 29 | + jobs: |
| 30 | + - template: .azure-pipelines/build-template.yml@self |
| 31 | + - job: PublishPrerelease |
| 32 | + displayName: Publish Prerelease |
| 33 | + dependsOn: BuildAndTest |
| 34 | + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) |
| 35 | + steps: |
| 36 | + - task: NodeTool@0 |
| 37 | + inputs: |
| 38 | + versionSpec: '16.x' |
| 39 | + displayName: Install node |
| 40 | + - script: npm install -g npm@8 |
| 41 | + displayName: Upgrade npm |
| 42 | + - task: NpmAuthenticate@0 |
| 43 | + inputs: |
| 44 | + workingFile: .npmrc |
| 45 | + - script: npm install |
| 46 | + displayName: npm install |
| 47 | + - script: npm run build |
| 48 | + displayName: npm run build |
| 49 | + - task: Npm@1 |
| 50 | + displayName: Publish azure-devops-node-api to npm |
| 51 | + inputs: |
| 52 | + command: custom |
| 53 | + customCommand: publish --tag prerelease |
| 54 | + workingDir: '_build' |
| 55 | + publishRegistry: useExternalRegistry |
| 56 | + customEndpoint: btt-npm-publish-token |
| 57 | + publishEndpoint: btt-npm-publish-token |
| 58 | + continueOnError: true |
| 59 | + - stage: Release |
| 60 | + displayName: Release to Latest |
| 61 | + trigger: manual |
| 62 | + dependsOn: Build |
| 63 | + jobs: |
| 64 | + - job: Release |
| 65 | + displayName: Release to Latest |
| 66 | + steps: |
| 67 | + - checkout: self |
| 68 | + clean: true |
| 69 | + - task: NodeTool@0 |
| 70 | + inputs: |
| 71 | + versionSpec: 16.x |
| 72 | + displayName: Install node |
| 73 | + - task: NpmAuthenticate@0 |
| 74 | + inputs: |
| 75 | + workingFile: .npmrc |
| 76 | + - script: npm install |
| 77 | + displayName: npm install |
| 78 | + - script: npm run build |
| 79 | + displayName: npm run build |
| 80 | + - bash: | |
| 81 | + package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"') |
| 82 | + echo "##vso[task.setvariable variable=npm_package]$package_name" |
| 83 | + workingDirectory: '_build' |
| 84 | + displayName: Get package name and version |
| 85 | + - task: Npm@1 |
| 86 | + displayName: Remove prerelease tag for azure-devops-node-api in Npm |
| 87 | + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) |
| 88 | + inputs: |
| 89 | + command: custom |
| 90 | + customCommand: dist-tag remove "$(npm_package)" prerelease |
| 91 | + workingDir: '_build' |
| 92 | + publishRegistry: useExternalRegistry |
| 93 | + customEndpoint: btt-npm-publish-token |
| 94 | + publishEndpoint: btt-npm-publish-token |
| 95 | + - task: Npm@1 |
| 96 | + displayName: Add latest tag for azure-devops-node-api in Npm |
| 97 | + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) |
| 98 | + inputs: |
| 99 | + command: custom |
| 100 | + customCommand: dist-tag add "$(npm_package)" latest |
| 101 | + workingDir: '_build' |
| 102 | + publishRegistry: useExternalRegistry |
| 103 | + customEndpoint: btt-npm-publish-token |
| 104 | + publishEndpoint: btt-npm-publish-token |
0 commit comments