forked from microsoft/CCF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.azure-pipelines-gh-pages.yml
122 lines (111 loc) · 3.9 KB
/
.azure-pipelines-gh-pages.yml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
trigger:
batch: true
branches:
include:
- main
- "refs/tags/ccf-*"
jobs:
- job: build_and_publish_docs
container: ccfmsrc.azurecr.io/ccf/ci:27-04-2023-virtual-clang15
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
clean: true
- script: |
set -ex
env
git status
git rev-parse HEAD
git checkout -b main $(git rev-parse HEAD)
displayName: Prepare repo
# Used to generate version.py
- template: .azure-pipelines-templates/cmake.yml
parameters:
cmake_args: "-DCOMPILE_TARGET=virtual"
# Note: Link checks are disabled for now as often lead to intermittent
# false positives (e.g. a third-party website being down) that may block
# releases
# - script: |
# set -ex
# python3.8 -m venv env
# source env/bin/activate
# pip install wheel
# pip install -U -r doc/requirements.txt
# pip install -U -e ./python
# sphinx-build -b linkcheck doc build/html
# displayName: Link checks
# Only the main branch builds and publishes the versioned documentation.
# This is because the configuration of the docs (e.g. theme) will change
# over time and only the main branch should be source of truth and be
# kept up to date.
#
# Only on main and not on PRs
# Note: override remote whitelist to detect release branches on remote
- script: |
set -ex
python3.8 -m venv env
source env/bin/activate
pip install wheel
pip install -U -r doc/requirements.txt
pip install -U -e ./python
pip install -U -r doc/historical_ccf_requirements.txt
sphinx-multiversion -D smv_remote_whitelist=origin doc build/html
displayName: Sphinx Multi-version
condition: |
and(
not(eq(variables['Build.Reason'], 'PullRequest')),
eq(variables['Build.SourceBranch'], 'refs/heads/main')
)
# Only on PRs and not on main (e.g. release branch/tag)
- script: |
set -ex
python3.8 -m venv env
source env/bin/activate
pip install wheel
pip install -U -r doc/requirements.txt
pip install -U -e ./python
sphinx-build doc build/html
displayName: Sphinx Single-version
condition: |
or(
eq(variables['Build.Reason'], 'PullRequest'),
not(eq(variables['Build.SourceBranch'], 'refs/heads/main'))
)
- script: |
set -ex
git init
git config --local user.name "Azure Pipelines"
git config --local user.email "azuredevops@microsoft.com"
git add .
touch .nojekyll
git add .nojekyll
cp ../../doc/index.html .
git add index.html
git commit -m "[ci skip] commit generated documentation"
displayName: "Commit pages"
workingDirectory: build/html
- task: DownloadSecureFile@1
inputs:
secureFile: ccf
displayName: "Get the deploy key"
- script: |
set -ex
mv $DOWNLOADSECUREFILE_SECUREFILEPATH deploy_key
chmod 600 deploy_key
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote add origin git@github.com:microsoft/CCF.git
GIT_SSH_COMMAND="ssh -i deploy_key" git push -f origin HEAD:gh-pages
displayName: "Publish GitHub Pages"
condition: |
and(
not(eq(variables['Build.Reason'], 'PullRequest')),
eq(variables['Build.SourceBranch'], 'refs/heads/main')
)
workingDirectory: build/html
- script: rm deploy_key || true
displayName: "Make sure key is removed"
workingDirectory: build/html
condition: always()