-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildAndDeployPackage.bat
98 lines (76 loc) · 1.91 KB
/
BuildAndDeployPackage.bat
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
::
:: BuildAndDeployPackage.bat
::
:: Author: Vincent Kocks (engineering@vingenuity.net)
:: v1.0.0
::
:: Builds packages in the project directory and deploys them.
::
:: Both the build and deploy steps can be skipped if desired.
::
@echo off
:: Static Environment Variables
set PROJECT_NAME=VRROOMpy
set PROJECT_ROOT=.
set DIST_ROOT=%PROJECT_ROOT%\dist
set PYTHON=python
rem set SKIP_BUILD=True
rem set SKIP_CLEAN=True
rem set SKIP_DEPLOY=True
rem set SKIP_INSTALL=True
rem set TEST_DEPLOY=True
:: Dynamic Environment Variables
if defined TEST_DEPLOY (
set TWINE_REPOSITORY=testpypi
) else (
set TWINE_REPOSITORY=pypi
)
:: Main Execution
:pre_clean
if defined SKIP_CLEAN (
echo Skipping deletion of old build packages due to %%SKIP_CLEAN%% being set.
goto :pre_install
)
:clean
if exist %DIST_ROOT% (
echo Deleting existing build packages within distribution root '%DIST_ROOT%'...
del %DIST_ROOT%\*.tar.gz
del %DIST_ROOT%\*.whl
)
:pre_install
if defined SKIP_INSTALL (
echo Skipping installation of required packages due to %%SKIP_INSTALL%% being set.
goto :pre_build
)
:install
if not defined SKIP_BUILD (
echo Installing latest PyPA build tools...
%PYTHON% -m pip install --upgrade build
)
if not defined SKIP_DEPLOY (
echo Installing latest Twine deployment tools...
%PYTHON% -m pip install --upgrade twine
)
:pre_build
if defined SKIP_BUILD (
echo Skipping building of package due to %%SKIP_BUILD%% being set.
goto :pre_deploy
)
:build
echo Building %PROJECT_NAME% package...
pushd %PROJECT_ROOT%
%PYTHON% -m build
popd
:pre_deploy
if defined SKIP_DEPLOY (
echo Skipping deployment of package due to %%SKIP_DEPLOY%% being set.
goto :finish
)
:deploy
echo Deploying %PROJECT_NAME% package to %TWINE_REPOSITORY%...
pushd %PROJECT_ROOT%
%PYTHON% -m twine upload --repository %TWINE_REPOSITORY% %DIST_ROOT%\*
popd
goto :finish
:finish
if /I not "%1"=="-nopause" pause