summaryrefslogtreecommitdiffstats
path: root/ci/azure-deploy-docs.yml
blob: 77ec1b0f64ae4f7a0a05b71cf0c98e1362adc34d (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
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
      rust_version: ${{ parameters.rust }}
  - script: |
      cargo doc --all --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/tokio
      git checkout -b gh-pages
      git add .
      git commit -m 'Deploy Tokio API documentation'
      git push -f origin gh-pages
    env:
      GITHUB_TOKEN: $(githubPersonalToken)
    workingDirectory: '$(Build.BinariesDirectory)'
    displayName: 'Deploy Documentation'