Dan*_*eaw 4 python azure-devops python-poetry
我正在尝试设置 Azure Devops 以使用 Poetry 发布到 PyPI 提要。
我了解 Twine 身份验证并将凭据存储到 Azure Key Vault。但是有没有更直接的方法呢?像这样的东西:
- script: |
source .venv/bin/activate
poetry build
displayName: Build wheel
- script: |
source .venv/bin/activate
poetry publish -u USER -p PASS
displayName: Publish wheel
Run Code Online (Sandbox Code Playgroud)
是的。在 Azure DevOps Web 界面中:
usernamepasswordazure-pipelines.ymlCI 文件的内容:trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.7
displayName: Install Python
- script: |
python -m pip install -U pip
pip install poetry
poetry install
displayName: Install software
- script: |
poetry run python -m unittest discover tests/ -v
displayName: Test software
- script: |
poetry build
displayName: Package software
- script: |
poetry config repositories.azure https://pkgs.dev.azure.com/{your organization}/_packaging/{your feed}/pypi/upload
poetry config http-basic.azure $(username) $(password)
poetry publish -r azure
exit 0
displayName: Publish software
Run Code Online (Sandbox Code Playgroud)
How about building with poetry and publishing with twine, so we can take advantage of Azure's own TwineAuthenticate:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
pip install poetry
pip install twine
poetry install --no-dev
displayName: 'Install dependencies'
- script: |
poetry build
displayName: 'Build package'
- task: TwineAuthenticate@1
inputs:
artifactFeed: 'repo-name/feed-name'
- script: |
twine upload -r repo-name --config-file $(PYPIRC_PATH) dist/*.whl
displayName: Upload package to Azure Artifact
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1864 次 |
| 最近记录: |