forked from SocketDev/socket-python-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_container.sh
More file actions
executable file
·36 lines (34 loc) · 1.63 KB
/
build_container.sh
File metadata and controls
executable file
·36 lines (34 loc) · 1.63 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
#!/bin/sh
VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
ENABLE_PYPI_BUILD=$1
STABLE_VERSION=$2
echo $VERSION
if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then
echo "$0 pypi-build=enable stable=true"
echo "\tpypi-build: Build and publish a new version of the package to pypi"
echo "\tstable: Only build and publish a new version for the stable docker tag if it has been tested and going on the changelog"
exit
fi
if [ $ENABLE_PYPI_BUILD = "pypi-build=enable" ]; then
echo "Doing production build"
python -m build --wheel --sdist
twine upload dist/*$VERSION*
sleep 240
docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:$VERSION . \
&& docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:latest . \
&& docker push socketdev/cli:$VERSION \
&& docker push socketdev/cli:latest
if [ $STABLE_VERSION = "stable=true" ]; then
docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:stable . \
&& docker push socketdev/cli:stable
fi
else
echo "Doing test build"
python -m build --wheel --sdist
twine upload --repository testpypi dist/*$VERSION*
# sleep 240
# docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:$VERSION . \
# && docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:latest . \
# && docker push socketdev/cli:$VERSION-test \
# && docker push socketdev/cli:test
fi