Skip to content

Commit 2357114

Browse files
authored
Merge pull request #140 from stan-dev/jenkins-addlinks
Added stage which links to latest.
2 parents bd1d16b + 77b1bf9 commit 2357114

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

Jenkinsfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pipeline {
99
parameters {
1010
string(defaultValue: '', name: 'major_version', description: "Major version of the docs to be built")
1111
string(defaultValue: '', name: 'minor_version', description: "Minor version of the docs to be built")
12+
string(defaultValue: '', name: 'last_docs_version_dir', description: "Last docs version found in /docs. Example: 2_21")
1213
}
1314
environment {
1415
GITHUB_TOKEN = credentials('6e7c1e8f-ca2c-4b11-a70e-d934d3f6b681')
@@ -48,6 +49,11 @@ pipeline {
4849
sh "python add_redirects.py $major_version $minor_version stan-users-guide"
4950
}
5051
}
52+
stage("Link docs to latest") {
53+
steps{
54+
sh "add_links.sh $last_docs_version_dir"
55+
}
56+
}
5157
stage("Push PR for docs") {
5258
steps {
5359
withCredentials([usernamePassword(credentialsId: 'a630aebc-6861-4e69-b497-fd7f496ec46b',

add_links.sh

100644100755
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
#!/usr/bin/env bash
22

3-
mkdir docs/2_20_tmp
4-
(cd docs/2_20; tar cf - .) | (cd docs/2_20_tmp; tar xvf - )
5-
python link_to_latest.py docs/2_20_tmp/stan-users-guide "Stan User's Guide"
6-
python link_to_latest.py docs/2_20_tmp/reference-manual "Stan Reference Manual"
7-
python link_to_latest.py docs/2_20_tmp/functions-reference "Stan Functions Reference"
8-
mv docs/2_20 docs/2_20_bak
9-
mv docs/2_20_tmp/ docs/2_20
3+
### USAGE
4+
# add_links.sh last_docs_version_dir
5+
# add_links.sh 2_21
6+
7+
directory="$1"
8+
9+
mkdir docs/"$directory"_tmp
10+
11+
(cd docs/"$directory"; tar cf - .) | (cd docs/"$directory"_tmp; tar xvf - )
12+
13+
python link_to_latest.py docs/"$directory"_tmp/stan-users-guide "Stan User's Guide"
14+
python link_to_latest.py docs/"$directory"_tmp/reference-manual "Stan Reference Manual"
15+
python link_to_latest.py docs/"$directory"_tmp/functions-reference "Stan Functions Reference"
16+
17+
mv docs/"$directory" docs/"$directory"_bak
18+
mv docs/"$directory"_tmp/ docs/"$directory"
19+
20+
rm -r "$directory"_tmp

0 commit comments

Comments
 (0)