|
| 1 | +name: Release |
1 | 2 | trigger: none |
2 | 3 | pr: none |
3 | 4 |
|
4 | 5 | resources: |
5 | 6 | repositories: |
6 | | - - repository: templates |
7 | | - type: github |
8 | | - name: microsoft/vscode-engineering |
9 | | - ref: main |
10 | | - endpoint: Monaco |
| 7 | + - repository: MicroBuildTemplate |
| 8 | + type: git |
| 9 | + name: 1ESPipelineTemplates/MicroBuildTemplate |
| 10 | + ref: refs/tags/release |
11 | 11 |
|
12 | 12 | parameters: |
13 | 13 | - name: publishPackage |
14 | 14 | displayName: 🚀 Publish Package |
15 | 15 | type: boolean |
16 | 16 | default: false |
17 | 17 |
|
| 18 | +variables: |
| 19 | + ARTIFACT_NAME_WHEEL: wheel |
| 20 | + architecture: x64 |
| 21 | + python.version: '3.8' |
| 22 | + TeamName: lsprotocol |
| 23 | + |
18 | 24 | extends: |
19 | | - template: azure-pipelines/pypi-package/pipeline.yml@templates |
| 25 | + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate |
20 | 26 | parameters: |
21 | | - publishPackage: ${{ parameters.publishPackage }} |
22 | | - pythonVersion: '3.8' |
23 | | - # We don't ship any built in packages. |
24 | | - generateNotice: false |
25 | | - projectRootDirectory: $(Build.SourcesDirectory)/packages/python |
26 | | - packageName: lsprotocol |
27 | | - buildSteps: |
28 | | - - script: python -m pip install nox |
29 | | - displayName: Install nox |
30 | | - |
31 | | - - script: python -m nox --session build_python_package |
32 | | - displayName: Build package (sdist and wheels) |
| 27 | + sdl: |
| 28 | + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES |
| 29 | + pool: |
| 30 | + name: AzurePipelines-EO |
| 31 | + demands: |
| 32 | + - ImageOverride -equals 1ESPT-Ubuntu22.04 |
| 33 | + os: Linux |
| 34 | + customBuildTags: |
| 35 | + - ES365AIMigrationTooling |
| 36 | + stages: |
| 37 | + - stage: Build |
| 38 | + displayName: Build |
| 39 | + jobs: |
| 40 | + - job: Build |
| 41 | + |
| 42 | + templateContext: |
| 43 | + outputs: |
| 44 | + - output: pipelineArtifact |
| 45 | + targetPath: $(Build.StagingDirectory)/dist |
| 46 | + sbomBuildDropPath: $(Build.StagingDirectory)/dist |
| 47 | + artifactName: $(ARTIFACT_NAME_WHEEL) |
| 48 | + |
| 49 | + steps: |
| 50 | + - checkout: self |
| 51 | + fetchDepth: 1 |
| 52 | + fetchTags: false |
| 53 | + |
| 54 | + - task: UsePythonVersion@0 |
| 55 | + inputs: |
| 56 | + versionSpec: '$(python.version)' |
| 57 | + architecture: '$(architecture)' |
| 58 | + displayName: 'Use Python $(python.version) $(architecture)' |
| 59 | + |
| 60 | + - script: python -m pip install nox |
| 61 | + displayName: Install nox |
| 62 | + |
| 63 | + - script: python -m nox --session build_python_package |
| 64 | + displayName: Build package (sdist and wheels) |
| 65 | + |
| 66 | + - powershell: | |
| 67 | + python -m pip install toml-cli |
| 68 | + $releaseVersion = & toml get --toml-path packages/python/pyproject.toml project.version |
| 69 | + echo "releaseVersion: $releaseVersion" |
| 70 | + echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion" |
| 71 | + displayName: Get release version |
| 72 | + name: getReleaseVersionStep |
| 73 | +
|
| 74 | + - script: ls -al packages/python/dist |
| 75 | + |
| 76 | + - task: CopyFiles@2 |
| 77 | + displayName: Copy wheel and tarball |
| 78 | + inputs: |
| 79 | + sourceFolder: packages/python/dist |
| 80 | + targetFolder: $(Build.StagingDirectory)/dist |
| 81 | + contents: | |
| 82 | + lsprotocol-$(getReleaseVersionStep.releaseVersion)-py3-none-any.whl |
| 83 | + lsprotocol-$(getReleaseVersionStep.releaseVersion).tar.gz |
| 84 | +
|
| 85 | + - stage: CreateTag |
| 86 | + displayName: Create Tag |
| 87 | + dependsOn: Build |
| 88 | + variables: |
| 89 | + releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] |
| 90 | + jobs: |
| 91 | + - job: CreateTag |
| 92 | + steps: |
| 93 | + - checkout: self |
| 94 | + fetchDepth: 1 |
| 95 | + fetchTags: false |
| 96 | + persistCredentials: true |
| 97 | + |
| 98 | + - script: | |
| 99 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 100 | + git config user.name "Azure Piplines" |
| 101 | + git fetch --depth 1 origin $(Build.SourceBranchName) |
| 102 | + git tag -a $(releaseVersion) -m "Release $(releaseVersion)" origin/$(Build.SourceBranchName) |
| 103 | + git push origin $(releaseVersion) |
| 104 | + displayName: Create git tag |
| 105 | +
|
| 106 | + - stage: CreateRelease |
| 107 | + displayName: Create GitHub Release |
| 108 | + dependsOn: |
| 109 | + - Build |
| 110 | + - CreateTag |
| 111 | + variables: |
| 112 | + releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ] |
| 113 | + jobs: |
| 114 | + - job: CreateRelease |
| 115 | + templateContext: |
| 116 | + type: releaseJob |
| 117 | + isProduction: true |
| 118 | + inputs: |
| 119 | + - input: pipelineArtifact |
| 120 | + artifactName: $(ARTIFACT_NAME_WHEEL) |
| 121 | + targetPath: $(Build.StagingDirectory)/dist |
| 122 | + steps: |
| 123 | + - task: GitHubRelease@1 #https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/github-release-v1?view=azure-pipelines |
| 124 | + displayName: Create GitHub Release |
| 125 | + inputs: |
| 126 | + gitHubConnection: GitHub-lsprotocol |
| 127 | + repositoryName: microsoft/lsprotocol |
| 128 | + action: create |
| 129 | + target: $(Build.SourceBranchName) |
| 130 | + title: $(releaseVersion) |
| 131 | + tag: $(releaseVersion) |
| 132 | + tagSource: userSpecifiedTag |
| 133 | + isDraft: true |
| 134 | + addChangeLog: false |
| 135 | + assets: $(Build.StagingDirectory)/dist/* |
| 136 | + |
| 137 | + - stage: WaitForValidation |
| 138 | + dependsOn: CreateRelease |
| 139 | + condition: and(succeeded(), ${{ parameters.publishPackage }}) |
| 140 | + jobs: |
| 141 | + - job: wait_for_validation |
| 142 | + displayName: Wait for manual validation |
| 143 | + pool: server |
| 144 | + steps: |
| 145 | + - task: ManualValidation@0 |
| 146 | + timeoutInMinutes: 1440 # task times out in 1 day |
| 147 | + inputs: |
| 148 | + |
| 149 | + instructions: Please test the latest draft release and then publish it. |
| 150 | + onTimeout: reject |
| 151 | + |
| 152 | + - stage: Release |
| 153 | + dependsOn: WaitForValidation |
| 154 | + jobs: |
| 155 | + - job: PublishToPyPi |
| 156 | + displayName: Release to PyPi |
| 157 | + |
| 158 | + pool: |
| 159 | + name: VSEngSS-MicroBuild2022-1ES # This pool is required to have the certs needed to publish to PyPi using ESRP. |
| 160 | + os: windows |
| 161 | + image: server2022-microbuildVS2022-1es |
| 162 | + |
| 163 | + templateContext: |
| 164 | + type: releaseJob |
| 165 | + isProduction: true |
| 166 | + inputs: |
| 167 | + - input: pipelineArtifact |
| 168 | + artifactName: $(ARTIFACT_NAME_WHEEL) |
| 169 | + targetPath: $(Build.StagingDirectory)/dist |
| 170 | + |
| 171 | + steps: |
| 172 | + - template: MicroBuild.Publish.yml@MicroBuildTemplate |
| 173 | + parameters: |
| 174 | + intent: PackageDistribution |
| 175 | + contentType: PyPi |
| 176 | + contentSource: Folder |
| 177 | + folderLocation: $(Build.StagingDirectory)/dist |
| 178 | + waitForReleaseCompletion: true |
| 179 | + |
| 180 | + |
0 commit comments