diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index b689702..348b254 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -12,36 +12,54 @@ trigger: none pr: none resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release pipelines: - - pipeline: nodeLibraryCI - project: 'Azure Functions' - source: azure-functions-nodejs-library.build + - pipeline: officialBuild + project: internal + source: nodejs-library.official branch: v4.x -jobs: - - job: Release - pool: - name: '1ES-Hosted-AzFunc' - demands: - - ImageOverride -equals MMSUbuntu20.04TLS - steps: - - download: nodeLibraryCI - - task: NodeTool@0 - displayName: 'Install Node.js' - inputs: - versionSpec: 18.x - - script: npm ci - displayName: 'npm ci' - - script: 'npm run validateRelease -- --publishTag ${{ parameters.NpmPublishTag }} --dropPath "$(Pipeline.Workspace)/nodeLibraryCI/drop"' - displayName: 'validate release' - - script: mv *.tgz package.tgz - displayName: 'Rename tgz file' # because the publish command below requires an exact path - workingDirectory: '$(Pipeline.Workspace)/nodeLibraryCI/drop' - - task: Npm@1 - displayName: 'npm publish' - inputs: - command: custom - workingDir: '$(Pipeline.Workspace)/nodeLibraryCI/drop' - verbose: true - customCommand: 'publish package.tgz --tag ${{ parameters.NpmPublishTag }} --dry-run ${{ lower(parameters.NpmPublishDryRun) }}' - customEndpoint: 'Functions Node.js Library Publish' +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1es + parameters: + sdl: + sourceAnalysisPool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + codeql: + runSourceLanguagesInSourceAnalysis: true + + stages: + - stage: Release + pool: + name: 1es-pool-azfunc + image: 1es-ubuntu-22.04 + os: linux + jobs: + - job: Release + steps: + - download: officialBuild + - task: NodeTool@0 + displayName: 'Install Node.js' + inputs: + versionSpec: 18.x + - script: npm ci + displayName: 'npm ci' + - script: 'npm run validateRelease -- --publishTag ${{ parameters.NpmPublishTag }} --dropPath "$(Pipeline.Workspace)/officialBuild/drop"' + displayName: 'validate release' + - script: mv *.tgz package.tgz + displayName: 'Rename tgz file' # because the publish command below requires an exact path + workingDirectory: '$(Pipeline.Workspace)/officialBuild/drop' + - task: Npm@1 + displayName: 'npm publish' + inputs: + command: custom + workingDir: '$(Pipeline.Workspace)/officialBuild/drop' + verbose: true + customCommand: 'publish package.tgz --tag ${{ parameters.NpmPublishTag }} --dry-run ${{ lower(parameters.NpmPublishDryRun) }}' + customEndpoint: nodejs-library-npm diff --git a/scripts/validateRelease.ts b/scripts/validateRelease.ts index dea8c6f..751cbf1 100644 --- a/scripts/validateRelease.ts +++ b/scripts/validateRelease.ts @@ -17,7 +17,7 @@ npm run validateRelease -- --publishTag preview --dropPath /example/path/`); } function validateRelease(publishTag: string, dropPath: string): void { - const files = readdirSync(dropPath); + const files = readdirSync(dropPath).filter((f) => f.endsWith('.tgz')); if (files.length !== 1) { throw new Error('Drop path should have one tgz file'); }