Repository navigation
Expand file tree
/
Copy pathpublish.bat
More file actions
executable file
·61 lines (50 loc) · 1.48 KB
/
Copy pathpublish.bat
File metadata and controls
executable file
·61 lines (50 loc) · 1.48 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
@echo off
REM NuoYi - Build and upload to PyPI
REM Usage: publish.bat [test|prod]
setlocal enabledelayedexpansion
set TARGET=%1
if "%TARGET%"=="" set TARGET=test
cd /d "%~dp0"
echo === NuoYi PyPI Publisher ===
REM Read version
for /f "delims=" %%v in ('python -c "exec(open('src/nuoyi/__init__.py').read());print(__version__)"') do set VERSION=%%v
echo Version: %VERSION%
REM Step 1: Clean
echo.
echo [1/4] Cleaning old builds...
if exist dist rmdir /s /q dist
if exist build rmdir /s /q build
for /d %%d in (src\*.egg-info) do rmdir /s /q "%%d"
REM Step 2: Install build tools
echo [2/4] Checking build tools...
python -m pip install --quiet build twine
REM Step 3: Build
echo [3/4] Building sdist and wheel...
python -m build
echo.
echo Built files:
dir /b dist\
REM Step 4: Upload
echo.
if "%TARGET%"=="prod" (
echo [4/4] Uploading to PyPI (production^)...
echo WARNING: This will publish to the real PyPI!
set /p confirm="Continue? [y/N] "
if /i "!confirm!"=="y" (
python -m twine upload dist\*
echo.
echo Done! Install with: pip install nuoyi==%VERSION%
) else (
echo Cancelled.
)
) else if "%TARGET%"=="test" (
echo [4/4] Uploading to TestPyPI...
python -m twine upload --repository testpypi dist\*
echo.
echo Done! Test install with:
echo pip install -i https://test.pypi.org/simple/ nuoyi==%VERSION%
) else (
echo [4/4] Skipping upload (unknown target: %TARGET%^)
echo Usage: publish.bat [test^|prod]
)
endlocal