diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml new file mode 100644 index 0000000..c1525a9 --- /dev/null +++ b/.github/workflows/version-check.yml @@ -0,0 +1,21 @@ +name: Version Check + +on: + pull_request: + +jobs: + version-check: + name: Ensure Version is as expected + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Python 3.x + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Version Check + run: python ./.github/workflows/version_check.py + shell: bash \ No newline at end of file diff --git a/.github/workflows/version_check.py b/.github/workflows/version_check.py new file mode 100644 index 0000000..05d5bf1 --- /dev/null +++ b/.github/workflows/version_check.py @@ -0,0 +1,18 @@ +import datetime +import pathlib +import sys + +pyproject = pathlib.Path(__file__).parent.parent.parent / "pyproject.toml" + +content = pyproject.read_text(encoding="utf-8") + +for line in content.splitlines(): + if line.startswith("version"): + version = line.split("=")[1].strip().strip('"') + year, minor, micro = version.split(".") + today = datetime.date.today() + if int(year) != today.year: + print(f"Version {version} year should be {today.year}") + sys.exit(1) + +print("Version check passed") diff --git a/azure-pipelines/template/static_analysis.yml b/azure-pipelines/template/static_analysis.yml index fc7acc7..e64e783 100644 --- a/azure-pipelines/template/static_analysis.yml +++ b/azure-pipelines/template/static_analysis.yml @@ -55,3 +55,18 @@ jobs: - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 displayName: Publish Security Analysis Logs + + - job: VersionChk + displayName: Version Check + + pool: + vmImage: ubuntu-latest + + steps: + - task: UsePythonVersion@0 + displayName: "Use Python 3.11" + inputs: + versionSpec: 3.11 + + - script: python ./.github/workflows/version_check.py + displayName: Version Check diff --git a/pyproject.toml b/pyproject.toml index a8f562e..43579b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] name = "lsprotocol" description = 'Python implementation of the Language Server Protocol.' -version = "2022.0.0a10" +version = "2023.0.0a11" authors = [{name = "Microsoft Corporation", email = "lsprotocol-help@microsoft.com"}] license = {file = "LICENSE"} readme = {"file" = "README.md", "content-type" = "text/markdown"}