Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# How to ship a release

1. Ensure that the project version number in [`packages/python/pyproject.toml`](packages/python/pyproject.toml) has been updated. Historically we have sometimes done this before the release. If not, change it now. Our versioning scheme is:
| Release type | Version format | Notes |
|--------------|----------------|-------|
| Stable | YYYY.0.N | `N` starts at `0` and increments with each release during the year |
| Release candidate | YYYY.O.NrcX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each RC |
| Beta | YYYY.0.NbX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each beta release |
| Alpha | YYYY.0.NaX | `YYYY.0.N` matches the upcoming stable release and `X` starts at `1` and increments with each alpha release |

1. Run the [`lsprotocol-Release` pipeline](https://dev.azure.com/devdiv/DevDiv/_build?definitionId=26767) against the `main` branch and check the `🚀 Publish Package` checkbox.
1. Wait for the pipeline to reach the `WaitForValidation` stage.
1. Run the `pygls` tests against the new release:
1. `git clone https://github.com/openlawlibrary/pygls`
1. `cd pygls`
1. `poetry install --all-extras` -- Save the path to the generated virtualenv
1. `poetry run poe test` -- Baseline. Note which tests fail, if any. Don't run their `test-pyodide` tests.
1. Download the `lsprotocol-*.tar.gz` file from the Github Release created by the pipeline.
1. Remove the `lsprotocol` directory in the Poetry virtualenv and create a new one using the `lsprotocol` directory within the `tar.gz`.
1. Rerun the tests -- Compare against baseline.
1. Once you're satisfied with the release, publish it by going to the `lsprotocol-Release` pipeline run that you started earlier and pressing the blue `Review` button and then pressing the blue `Resume` button to initiate publishing.
1. Publish the GitHub release (it was created as a draft).
184 changes: 166 additions & 18 deletions azure-pipelines/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,180 @@
name: Release
trigger: none
pr: none

resources:
repositories:
- repository: templates
type: github
name: microsoft/vscode-engineering
ref: main
endpoint: Monaco
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release

parameters:
- name: publishPackage
displayName: 🚀 Publish Package
type: boolean
default: false

variables:
ARTIFACT_NAME_WHEEL: wheel
architecture: x64
python.version: '3.8'
TeamName: lsprotocol

extends:
template: azure-pipelines/pypi-package/pipeline.yml@templates
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
publishPackage: ${{ parameters.publishPackage }}
pythonVersion: '3.8'
# We don't ship any built in packages.
generateNotice: false
projectRootDirectory: $(Build.SourcesDirectory)/packages/python
packageName: lsprotocol
buildSteps:
- script: python -m pip install nox
displayName: Install nox

- script: python -m nox --session build_python_package
displayName: Build package (sdist and wheels)
sdl:
sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES
pool:
name: AzurePipelines-EO
demands:
- ImageOverride -equals 1ESPT-Ubuntu22.04
os: Linux
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: Build
displayName: Build
jobs:
- job: Build

templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(Build.StagingDirectory)/dist
sbomBuildDropPath: $(Build.StagingDirectory)/dist
artifactName: $(ARTIFACT_NAME_WHEEL)

steps:
- checkout: self
fetchDepth: 1
fetchTags: false

- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: '$(architecture)'
displayName: 'Use Python $(python.version) $(architecture)'

- script: python -m pip install nox
displayName: Install nox

- script: python -m nox --session build_python_package
displayName: Build package (sdist and wheels)

- powershell: |
python -m pip install toml-cli
$releaseVersion = & toml get --toml-path packages/python/pyproject.toml project.version
echo "releaseVersion: $releaseVersion"
echo "##vso[task.setvariable variable=releaseVersion;isOutput=true]$releaseVersion"
displayName: Get release version
name: getReleaseVersionStep

- script: ls -al packages/python/dist

- task: CopyFiles@2
displayName: Copy wheel and tarball
inputs:
sourceFolder: packages/python/dist
targetFolder: $(Build.StagingDirectory)/dist
contents: |
lsprotocol-$(getReleaseVersionStep.releaseVersion)-py3-none-any.whl
lsprotocol-$(getReleaseVersionStep.releaseVersion).tar.gz

- stage: CreateTag
displayName: Create Tag
dependsOn: Build
variables:
releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ]
jobs:
- job: CreateTag
steps:
- checkout: self
fetchDepth: 1
fetchTags: false
persistCredentials: true

- script: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "Azure Piplines"
git fetch --depth 1 origin $(Build.SourceBranchName)
git tag -a $(releaseVersion) -m "Release $(releaseVersion)" origin/$(Build.SourceBranchName)
git push origin $(releaseVersion)
displayName: Create git tag

- stage: CreateRelease
displayName: Create GitHub Release
dependsOn:
- Build
- CreateTag
variables:
releaseVersion: $[ stageDependencies.Build.Build.outputs['getReleaseVersionStep.releaseVersion'] ]
jobs:
- job: CreateRelease
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
artifactName: $(ARTIFACT_NAME_WHEEL)
targetPath: $(Build.StagingDirectory)/dist
steps:
- task: GitHubRelease@1 #https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/github-release-v1?view=azure-pipelines
displayName: Create GitHub Release
inputs:
gitHubConnection: GitHub-lsprotocol
repositoryName: microsoft/lsprotocol
action: create
target: $(Build.SourceBranchName)
title: $(releaseVersion)
tag: $(releaseVersion)
tagSource: userSpecifiedTag
isDraft: true
addChangeLog: false
assets: $(Build.StagingDirectory)/dist/*

- stage: WaitForValidation
dependsOn: CreateRelease
condition: and(succeeded(), ${{ parameters.publishPackage }})
jobs:
- job: wait_for_validation
displayName: Wait for manual validation
pool: server
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: [email protected]
instructions: Please test the latest draft release and then publish it.
onTimeout: reject

- stage: Release
dependsOn: WaitForValidation
jobs:
- job: PublishToPyPi
displayName: Release to PyPi

pool:
name: VSEngSS-MicroBuild2022-1ES # This pool is required to have the certs needed to publish to PyPi using ESRP.
os: windows
image: server2022-microbuildVS2022-1es

templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
artifactName: $(ARTIFACT_NAME_WHEEL)
targetPath: $(Build.StagingDirectory)/dist

steps:
- template: MicroBuild.Publish.yml@MicroBuildTemplate
parameters:
intent: PackageDistribution
contentType: PyPi
contentSource: Folder
folderLocation: $(Build.StagingDirectory)/dist
waitForReleaseCompletion: true
owners: [email protected]
approvers: [email protected]
Loading