Skip to content

Commit c708cc3

Browse files
authored
Update release pipeline to use 1es templates [v3.x] (#271)
1 parent 25c4639 commit c708cc3

File tree

2 files changed

+59
-41
lines changed

2 files changed

+59
-41
lines changed

azure-pipelines/release.yml

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,65 @@
11
parameters:
2-
- name: NpmPublishTag
3-
displayName: 'Tag'
4-
type: string
5-
default: 'legacy'
6-
- name: NpmPublishDryRun
7-
displayName: 'Dry Run'
8-
type: boolean
9-
default: true
2+
- name: NpmPublishTag
3+
displayName: 'Tag'
4+
type: string
5+
default: 'legacy'
6+
- name: NpmPublishDryRun
7+
displayName: 'Dry Run'
8+
type: boolean
9+
default: true
1010

1111
trigger: none
1212
pr: none
1313

1414
resources:
15-
pipelines:
16-
- pipeline: nodeLibraryCI
17-
project: 'Azure Functions'
18-
source: azure-functions-nodejs-library.build
19-
branch: v3.x
15+
repositories:
16+
- repository: 1es
17+
type: git
18+
name: 1ESPipelineTemplates/1ESPipelineTemplates
19+
ref: refs/tags/release
20+
pipelines:
21+
- pipeline: officialBuild
22+
project: internal
23+
source: nodejs-library.official
24+
branch: v3.x
2025

21-
jobs:
22-
- job: Release
23-
pool:
24-
name: '1ES-Hosted-AzFunc'
25-
demands:
26-
- ImageOverride -equals MMSUbuntu20.04TLS
27-
steps:
28-
- download: nodeLibraryCI
29-
- task: NodeTool@0
30-
displayName: 'Install Node.js'
31-
inputs:
32-
versionSpec: 14.x
33-
- script: npm ci
34-
displayName: 'npm ci'
35-
- script: 'npm run validateRelease -- --publishTag ${{ parameters.NpmPublishTag }} --dropPath "$(Pipeline.Workspace)/nodeLibraryCI/drop"'
36-
displayName: 'validate release'
37-
- script: mv *.tgz package.tgz
38-
displayName: 'Rename tgz file' # because the publish command below requires an exact path
39-
workingDirectory: '$(Pipeline.Workspace)/nodeLibraryCI/drop'
40-
- task: Npm@1
41-
displayName: 'npm publish'
42-
inputs:
43-
command: custom
44-
workingDir: '$(Pipeline.Workspace)/nodeLibraryCI/drop'
45-
verbose: true
46-
customCommand: 'publish package.tgz --tag ${{ parameters.NpmPublishTag }} --dry-run ${{ lower(parameters.NpmPublishDryRun) }}'
47-
customEndpoint: 'Functions Node.js Library Publish'
26+
extends:
27+
template: v1/1ES.Official.PipelineTemplate.yml@1es
28+
parameters:
29+
sdl:
30+
sourceAnalysisPool:
31+
name: 1es-pool-azfunc
32+
image: 1es-windows-2022
33+
os: windows
34+
codeql:
35+
runSourceLanguagesInSourceAnalysis: true
36+
37+
stages:
38+
- stage: Release
39+
pool:
40+
name: 1es-pool-azfunc
41+
image: 1es-ubuntu-22.04
42+
os: linux
43+
jobs:
44+
- job: Release
45+
steps:
46+
- download: officialBuild
47+
- task: NodeTool@0
48+
displayName: 'Install Node.js'
49+
inputs:
50+
versionSpec: 14.x
51+
- script: npm ci
52+
displayName: 'npm ci'
53+
- script: 'npm run validateRelease -- --publishTag ${{ parameters.NpmPublishTag }} --dropPath "$(Pipeline.Workspace)/officialBuild/drop"'
54+
displayName: 'validate release'
55+
- script: mv *.tgz package.tgz
56+
displayName: 'Rename tgz file' # because the publish command below requires an exact path
57+
workingDirectory: '$(Pipeline.Workspace)/officialBuild/drop'
58+
- task: Npm@1
59+
displayName: 'npm publish'
60+
inputs:
61+
command: custom
62+
workingDir: '$(Pipeline.Workspace)/officialBuild/drop'
63+
verbose: true
64+
customCommand: 'publish package.tgz --tag ${{ parameters.NpmPublishTag }} --dry-run ${{ lower(parameters.NpmPublishDryRun) }}'
65+
customEndpoint: nodejs-library-npm

scripts/validateRelease.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm run validateRelease -- --publishTag preview --dropPath /example/path/`);
1717
}
1818

1919
function validateRelease(publishTag: string, dropPath: string): void {
20-
const files = readdirSync(dropPath);
20+
const files = readdirSync(dropPath).filter((f) => f.endsWith('.tgz'));
2121
if (files.length !== 1) {
2222
throw new Error('Drop path should have one tgz file');
2323
}

0 commit comments

Comments
 (0)