parameters:
  dependsOn: []

jobs:
  - job: documentation
    displayName: "Deploy API Documentation"
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
    pool:
      vmImage: "Ubuntu 16.04"
    dependsOn:
      - ${{ parameters.dependsOn }}
    steps:
      - template: azure-install-rust.yml
        parameters:
          rust_version: stable
      - script: |
          cargo doc --no-deps
          cp -R target/doc '$(Build.BinariesDirectory)'
        displayName: "Generate Documentation"
      - script: |
          set -e

          git --version
          ls -la
          git init
          git config user.name 'Deployment Bot (from Azure Pipelines)'
          git config user.email 'deploy@tokio-rs.com'
          git config --global credential.helper 'store --file ~/.my-credentials'
          printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store
          git remote add origin https://github.com/tokio-rs/mio
          git checkout -b gh-pages
          git add .
          git commit -m 'Deploy Mio API documentation'
          git push -f origin gh-pages
        env:
          GITHUB_TOKEN: $(githubPersonalToken)
        workingDirectory: "$(Build.BinariesDirectory)"
        displayName: "Deploy Documentation"

parameters:
  dependsOn: []

jobs:
  - job: documentation
    displayName: "Deploy API Documentation"
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
    pool:
      vmImage: "Ubuntu 16.04"
    dependsOn:
      - ${{ parameters.dependsOn }}
    steps:
      - template: azure-install-rust.yml
        parameters:
          rust_version: stable
      - script: |
          cargo doc --no-deps --all-features
          cp -R target/doc '$(Build.BinariesDirectory)'
        displayName: "Generate Documentation"
      - script: |
          set -e

          git --version
          ls -la
          git init
          git config user.name 'Deployment Bot (from Azure Pipelines)'
          git config user.email 'deploy@tokio-rs.com'
          git config --global credential.helper 'store --file ~/.my-credentials'
          printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store
          git remote add origin https://github.com/tokio-rs/mio
          git checkout -b gh-pages
          git add .
          git commit -m 'Deploy Mio API documentation'
          git push -f origin gh-pages
        env:
          GITHUB_TOKEN: $(githubPersonalToken)
        workingDirectory: "$(Build.BinariesDirectory)"
        displayName: "Deploy Documentation"

Use all feature when building docs for master branch
Use all feature when building docs for master branch
