forked from Azure/azure-sdk-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathci.yml
More file actions
115 lines (100 loc) · 3.78 KB
/
ci.yml
File metadata and controls
115 lines (100 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- tools/apiview/parsers/js-api-parser
pr:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- tools/apiview/parsers/js-api-parser
extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
parameters:
stages:
- stage: 'Build'
variables:
- template: /eng/pipelines/templates/variables/image.yml
- name: NodeVersion
value: '18.x'
- name: ArtifactName
value: 'apiview'
- name: TypeScriptGeneratorDirectory
value: 'tools/apiview/parsers/js-api-parser'
jobs:
- job: 'Build'
pool:
name: $(LINUXNEXTPOOL)
image: $(LINUXNEXTVMIMAGE)
os: linux
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NodeVersion)'
displayName: 'Use NodeJS $(NodeVersion)'
- script: |
npm install -g npm@8.16.0
displayName: "Install npm 8.16.0"
- script: |
npm install
workingDirectory: $(TypeScriptGeneratorDirectory)
displayName: "Install npm packages typescript generator"
- script: |
npm run-script build
workingDirectory: $(TypeScriptGeneratorDirectory)
displayName: "Build typescript generator"
- pwsh: |
npm pack $(TypeScriptGeneratorDirectory)
Copy-Item ./*.tgz $(Build.ArtifactStagingDirectory)
displayName: "Pack typescript generator"
- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: $(ArtifactName)
- ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}:
- stage: 'Release'
dependsOn: Build
condition: Succeeded()
variables:
- template: /eng/pipelines/templates/variables/image.yml
- name: ArtifactName
value: 'apiview'
- name: TypeScriptGeneratorDirectory
value: 'tools/apiview/parsers/js-api-parser'
jobs:
- job: PublishPackage
displayName: 'Publish ts-genapi package to devops feed'
pool:
name: $(LINUXNEXTPOOL)
image: $(LINUXNEXTVMIMAGE)
os: linux
steps:
- download: current
- pwsh: |
$detectedPackageName=Get-ChildItem $(Pipeline.Workspace)/$(ArtifactName)/*.tgz
Write-Host "Detected package name: $detectedPackageName"
Write-Host "##vso[task.setvariable variable=PackageArtifactFullPath]$detectedPackageName"
displayName: "Find package artifact"
- pwsh: |
@"
registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/
always-auth=true
"@ | Set-Content -Path $(TypeScriptGeneratorDirectory)/.npmrc -NoNewline
displayName: Generate .npmrc
- task: NpmAuthenticate@0
inputs:
workingFile: $(TypeScriptGeneratorDirectory)/.npmrc
- pwsh: |
npm publish $(PackageArtifactFullPath) --registry https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/
workingDirectory: $(TypeScriptGeneratorDirectory)