summaryrefslogtreecommitdiffstats
path: root/azure-pipelines/template/publish_pypi.yml
blob: 1f29e1b2e39992a934f8b62dba28de45ad472557 (plain)
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
36
37
38
39
40
41
42
43
parameters:
  - name: publishPyPI
    displayName: 🚀 Publish To PyPI
    type: string

jobs:
  - job: PublishPkg
    displayName: Publish Packages

    pool:
      vmImage: windows-latest

    steps:
      - task: DownloadPipelineArtifact@2
        displayName: "Download Pipeline Artifact"
        inputs:
          artifactName: dist
          targetPath: "$(Build.SourcesDirectory)/dist"

      - task: UsePythonVersion@0
        displayName: "Use Python 3.7"
        inputs:
          versionSpec: 3.7

      - script: python -m pip install -U pip
        displayName: Upgrade Pip

      - script: python -m pip install twine
        displayName: Install Twine

      - ${{ if eq(parameters.publishPyPI, 'Test') }}:
          - script: python -m twine upload -r testpypi dist/*
            displayName: Publish to Test PyPI
            env:
              TWINE_USERNAME: __token__
              TWINE_PASSWORD: $(test_pypi_token)

      - ${{ if eq(parameters.publishPyPI, 'Real') }}:
          - script: python -m twine upload dist/*
            displayName: Publish to PyPI
            env:
              TWINE_USERNAME: __token__
              TWINE_PASSWORD: $(real_pypi_token)