Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure version matches the year. #146

Merged
merged 2 commits into from
Jan 11, 2023
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
21 changes: 21 additions & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .github/workflows/version_check.py
Original file line number Diff line number Diff line change
@@ -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")
15 changes: 15 additions & 0 deletions azure-pipelines/template/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"}]
license = {file = "LICENSE"}
readme = {"file" = "README.md", "content-type" = "text/markdown"}
Expand Down