Publicar pacotes do Python com Azure Pipelines
Azure DevOps Services
Usando Azure Pipelines, você pode publicar seus pacotes do Python para Azure Artifacts feeds, registros públicos ou como artefatos de pipeline.
Esta artigo mostrará como:
- Instalar
Twine
- Autenticar com seus feeds Azure Artifacts
- Publicar pacotes do Python em um feed de Azure Artifacts
Instalar o gêmeo
Autenticar com Azure Artifacts
Para usar twine
para publicar seus pacotes do Python, primeiro você deve configurar a autenticação para você Azure Artifacts feed. A tarefa TwineAuthenticate armazena suas credenciais em uma PYPIRC_PATH
variável de ambiente. twine
fará referência a essa variável para publicar seus pacotes do pipeline.
- task: TwineAuthenticate@1
inputs:
artifactFeed: <PROJECT_NAME/FEED_NAME> #Provide the FeedName only if you are using an organization-scoped feed.
pythonUploadServiceConnection: <NAME_OF_YOUR_SERVICE_CONNECTION>
- artifactFeed: o nome do feed.
- pythonUploadServiceConnection: uma conexão de serviço para autenticar com o twine.
Dica
As credenciais armazenadas na variável de PYPIRC_PATH
ambiente substituem as de seus .ini
arquivos..conf
Se você adicionar várias tarefas TwineAuthenticate em estágios diferentes em seu pipeline, cada execução de tarefa adicional estenderá (não substituirá) a variável de ambiente existente PYPIRC_PATH
.
Publicar pacotes do Python em feeds Azure Artifacts
- script: |
pip install wheel
pip install twine
- script: |
python setup.py bdist_wheel
- task: TwineAuthenticate@1
displayName: Twine Authenticate
inputs:
artifactFeed: projectName/feedName #Provide the FeedName only if you are using an organization-scoped feed.
- script: |
python -m twine upload -r feedName --config-file $(PYPIRC_PATH) dist/*.whl