🚸 添加发布工作流

This commit is contained in:
snowy 2024-08-18 03:57:15 +08:00
parent 5f5dcc7f99
commit 53291822c0
2 changed files with 27 additions and 3 deletions

23
liteyuki/version.py Normal file
View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
@Time : 2024/8/18 上午3:49
@Author : snowykami
@Email : snowykami@outlook.com
@File : version.py.py
@Software: PyCharm
"""
from git import Repo
from pdm.backend.hooks.version import SCMVersion
try:
__commit__ = Repo(".").head.commit.hexsha
except:
__commit__ = "unknown"
__version__ = "6.3.5"
def format_version(version: SCMVersion) -> str:
return f"{__version__}+{__commit__[:7]}"

View File

@ -20,6 +20,7 @@ dependencies = [
"PyYAML==6.0.2", "PyYAML==6.0.2",
"toml==0.10.2", "toml==0.10.2",
"watchdog==4.0.1", "watchdog==4.0.1",
"GitPython~=3.1.42"
] ]
[project.urls] [project.urls]
@ -29,7 +30,7 @@ Repository = "https://github.com/LiteyukiStudio/LiteyukiBot"
[build-system] [build-system]
requires = ["pdm-backend"] requires = ["pdm-backend", "loguru", "pydantic", "PyYAML", "toml", "watchdog", "GitPython"]
build-backend = "pdm.backend" build-backend = "pdm.backend"
[tool.pdm.build] [tool.pdm.build]
@ -38,5 +39,5 @@ excludes = ["tests/", "docs/", "src/"]
[tool.pdm.version] [tool.pdm.version]
source = "scm" source = "scm"
tag_filter = "test/*" version_format = "liteyuki.version:format_version"
tag_regex = '^test/(?:\D*)?(?P<version>([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|c|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$)$' fallback_version = "6.0.0"