# Assumes are running using the Ubuntu Codebuild standard image # Makes a release deployment to production PyPi repo. # # NOTE: This script assumes that the AWS CLI-V2 is pre-installed! # - AWS CLI-V2 is a requirement to run this script. version: 0.2 phases: install: commands: - sudo apt-get update -y - sudo apt-get install python3 python3-pip -y - export PATH=$PATH:$HOME/.local/bin - python3 -m pip install --user --upgrade pip - python3 -m pip install --user --upgrade twine setuptools wheel awscli PyOpenSSL six - echo "\nBuild version data:" - echo "\nPython Version:"; python3 --version pre_build: commands: - cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-python-v2 - pypirc=$(aws secretsmanager get-secret-value --secret-id "cd/aws-sdk-python-v2-prod/.pypirc" --query "SecretString" | cut -f2 -d\") && echo "$pypirc" > ~/.pypirc - export PKG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION) - echo "Updating package version to ${PKG_VERSION}" - sed --in-place -E "s/__version__ = '.+'/__version__ = '${PKG_VERSION}'/" awsiot/__init__.py build: commands: - echo Build started on `date` - python3 setup.py sdist bdist_wheel - python3 -m twine upload -r pypi dist/* post_build: commands: - echo Build completed on `date`