使用 Bitbucket 的 Package Registry 作为包管理器。
使用 Bitbucket Package Registry 作为包管理器的步骤如下:
bitbucket-pipelines.yml
文件。pipe curl --fail -X PUT -u $BITBUCKET_USERNAME:$BITBUCKET_APP_PASSWORD https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/packages/pypi/$PACKAGE_NAME/$PACKAGE_VERSION/ -F content=@$PACKAGE_FILE
命令将软件包上传到 Package Registry 。示例 bitbucket-pipelines.yml
文件:
pipelines:
default:
- step:
name: Build and Publish
script:
- pip install setuptools wheel twine
- python setup.py sdist bdist_wheel
- twine upload --repository-url https://api.bitbucket.org/2.0/repositories///packages/pypi/ dist/*
其中
和
分别替换为你的 Bitbucket 用户名和仓库名称。
上传软件包的命令示例:
pipe curl --fail -X PUT -u $BITBUCKET_USERNAME:$BITBUCKET_APP_PASSWORD https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/packages/pypi/// -F content=@
其中
、
和
分别替换为你的软件包名称、版本号和文件路径。
注意:上传软件包的命令需要在 Bitbucket Pipeline 构建过程中运行。