@@ -24,9 +24,15 @@ verify_package() {
2424
2525echo $VERSION
2626if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then
27- echo " $0 pypi-build=enable stable=true"
28- echo " \tpypi-build: Build and publish a new version of the package to pypi. Options are prod or test"
29- echo " \tstable: Only build and publish a new version for the stable docker tag if it has been tested and going on the changelog"
27+ echo " $0 pypi-build=<option> stable=<true|false|prod|test>"
28+ echo " \tpypi-build: Options are prod, test, or local"
29+ echo " \t - prod: Build and publish to production PyPI, then build Docker images"
30+ echo " \t - test: Build and publish to test PyPI, then build Docker images"
31+ echo " \t - local: Build Docker images only using existing PyPI package (specify prod or test via stable parameter)"
32+ echo " \tstable: true/false/prod/test - Also tag as stable; for local builds:"
33+ echo " \t - stable=prod: Use production PyPI package"
34+ echo " \t - stable=test: Use test PyPI package"
35+ echo " \t - stable=false: Use local development install (pip install -e .)"
3036 exit
3137fi
3238
@@ -97,3 +103,44 @@ if [ $STABLE_VERSION = "stable=true" ]; then
97103 && docker push socketdev/cli:stable
98104fi
99105
106+ if [ $ENABLE_PYPI_BUILD = " pypi-build=local" ]; then
107+ echo " Building local version without publishing to PyPI"
108+
109+ # Determine PyPI source based on stable parameter
110+ if [ $STABLE_VERSION = " stable=prod" ]; then
111+ echo " Using production PyPI"
112+ PIP_INDEX_URL=" https://pypi.org/simple"
113+ PIP_EXTRA_INDEX_URL=" https://pypi.org/simple"
114+ TAG_SUFFIX=" local"
115+ USE_LOCAL_INSTALL=" false"
116+ elif [ $STABLE_VERSION = " stable=test" ]; then
117+ echo " Using test PyPI"
118+ PIP_INDEX_URL=" https://test.pypi.org/simple"
119+ PIP_EXTRA_INDEX_URL=" https://pypi.org/simple"
120+ TAG_SUFFIX=" local-test"
121+ USE_LOCAL_INSTALL=" false"
122+ elif [ $STABLE_VERSION = " stable=false" ]; then
123+ echo " Using local development install (pip install -e .)"
124+ TAG_SUFFIX=" local-dev"
125+ USE_LOCAL_INSTALL=" true"
126+ else
127+ echo " For local builds, use stable=prod, stable=test, or stable=false"
128+ exit 1
129+ fi
130+
131+ if [ $USE_LOCAL_INSTALL = " true" ]; then
132+ docker build --no-cache \
133+ --build-arg USE_LOCAL_INSTALL=true \
134+ -t socketdev/cli:$VERSION -$TAG_SUFFIX \
135+ -t socketdev/cli:$TAG_SUFFIX .
136+ else
137+ docker build --no-cache \
138+ --build-arg CLI_VERSION=$VERSION \
139+ --build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
140+ --build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL \
141+ -t socketdev/cli:$VERSION -$TAG_SUFFIX \
142+ -t socketdev/cli:$TAG_SUFFIX .
143+ fi
144+ echo " Local build complete. Tagged as socketdev/cli:$VERSION -$TAG_SUFFIX and socketdev/cli:$TAG_SUFFIX "
145+ fi
146+
0 commit comments