This repository was archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bat
More file actions
70 lines (57 loc) · 1.46 KB
/
build.bat
File metadata and controls
70 lines (57 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@echo off
setlocal enabledelayedexpansion
:: Check if version.py file exists
if not exist src\fireapi\version.py (
echo version.py file not found.
exit /b 1
)
:: Prompt for version update type
set /p versionType="Enter version update type (major, minor, patch): "
:: Read the current version from version.py
for /f "tokens=3 delims= " %%i in ('findstr /r /c:"__version__ = " src\fireapi\version.py') do (
set currentVersion=%%i
)
:: Remove quotes from the version string
set currentVersion=%currentVersion:~1,-1%
:: Split the version into major, minor, and patch
for /f "tokens=1,2,3 delims=." %%a in ("%currentVersion%") do (
set major=%%a
set minor=%%b
set patch=%%c
)
:: Increment the version based on user input
if "%versionType%"=="major" (
set /a major+=1
set minor=0
set patch=0
) else if "%versionType%"=="minor" (
set /a minor+=1
set patch=0
) else if "%versionType%"=="patch" (
set /a patch+=1
) else (
echo Invalid version type.
exit /b 1
)
:: Form the new version string
set newVersion=%major%.%minor%.%patch%
:: Update version.py with the new version (no trailing space or newline)
(
echo __version__ = "%newVersion%"
) > src\fireapi\version.py
:: Run black for code formatting
black .
if errorlevel 1 (
echo Code formatting failed.
exit /b 1
)
isort .
if errorlevel 1 (
echo Imports sorting failed.
exit /b 1
)
:: Build the library
python -m build
:: Upload to PyPI
twine upload dist/*
endlocal