File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939 - name : Install dependencies
4040 run : |
4141 python -m pip install --upgrade pip
42- pip install build twine
42+ pip install build twine toml
43+ - name : Sync version to server.json
44+ run : |
45+ python -c "
46+ import toml
47+ import json
48+ import re
49+
50+ # 从 pyproject.toml 读取版本
51+ with open('pyproject.toml', 'r') as f:
52+ pyproject = toml.load(f)
53+ version = pyproject['project']['version']
54+ print(f'Version from pyproject.toml: {version}')
55+
56+ # 更新 server.json
57+ with open('server.json', 'r') as f:
58+ server = json.load(f)
59+
60+ server['version'] = version
61+ server['packages'][0]['version'] = version
62+
63+ with open('server.json', 'w') as f:
64+ json.dump(server, f, indent=2)
65+ f.write('\n')
66+
67+ print(f'Updated server.json to version {version}')
68+ "
4369 - name : Build package
4470 run : python -m build
4571 - name : Check distribution
You can’t perform that action at this time.
0 commit comments