parameters:
  vmImage:

jobs:
- job: Package
  dependsOn:
    - Test_Primary
    - Test_Secondary
  pool:
    vmImage: ${{ parameters.vmImage }}

  steps:
  - task: UsePythonVersion@0
    displayName: Use Python 3 latest
    inputs:
      versionSpec: '3'

  - bash: pip install setuptools tox wheel invoke towncrier requests
    displayName: Install dependencies

  - bash: invoke generate.authors
    displayName: Generate AUTHORS.txt

  - bash: invoke generate.news --yes
    displayName: Generate NEWS.rst

  - bash: tox -e packaging
    displayName: Run Tox packaging

  - bash: python setup.py sdist bdist_wheel
    displayName: Create sdist and wheel

  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: dist'
    inputs:
      pathtoPublish: dist
      artifactName: dist
