This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdoc.Jenkinsfile
90 lines (90 loc) · 4 KB
/
doc.Jenkinsfile
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
// The pipeline in this file syncs documentation from the project's s3 bucket to
// docs.posit.co where documentation is publicly visible. This pipeline
// should be manually triggered on Jenkins when a release is cut.
pipeline {
agent { node('docker') }
parameters {
string(name: 'RELEASE_VERSION', description: 'The release version (maj.min.patch.build) to promote.')
booleanParam(name: 'S3_SYNC', description: 'When checked, push artifacts to S3')
booleanParam(name: 'PYPI_RELEASE', description: 'When checked, push the wheel and sdist to PyPI')
}
stages {
stage('Check Parameters') {
when {
expression { return params.RELEASE_VERSION == "" }
}
steps {
error "You need to specify a release version to promote."
}
}
stage('Promote Docs (Dry Run)') {
when {
allOf {
expression { return !params.S3_SYNC }
expression { return params.RELEASE_VERSION != "" }
}
}
steps {
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.html s3://docs.rstudio.com/rsconnect-jupyter/ --dryrun"
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.html s3://docs.rstudio.com/rsconnect-jupyter/index.html --dryrun"
}
}
stage('Promote Docs') {
when {
allOf {
expression { return params.S3_SYNC }
expression { return params.RELEASE_VERSION != "" }
}
}
steps {
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.html s3://docs.rstudio.com/rsconnect-jupyter/"
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.html s3://docs.rstudio.com/rsconnect-jupyter/index.html"
}
}
stage('Release to PyPI (dry run)') {
when {
allOf {
expression { return !params.PYPI_RELEASE }
expression { return params.RELEASE_VERSION != "" }
}
}
environment {
PYPI_CREDS = credentials('pypi')
}
steps {
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}-py2.py3-none-any.whl ."
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.tar.gz ."
sh "pip install --user --upgrade twine==1.15 setuptools wheel"
sh """python -m twine upload \
--repository-url https://test.pypi.org/legacy/ \
-u ${PYPI_CREDS_USR} \
-p ${PYPI_CREDS_PSW} \
rsconnect_jupyter-${RELEASE_VERSION}-py2.py3-none-any.whl \
rsconnect_jupyter-${RELEASE_VERSION}.tar.gz \
"""
}
}
stage('Release to PyPI') {
when {
allOf {
expression { return params.PYPI_RELEASE }
expression { return params.RELEASE_VERSION != "" }
}
}
environment {
PYPI_CREDS = credentials('pypi')
}
steps {
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}-py2.py3-none-any.whl ."
sh "aws s3 cp s3://rstudio-rsconnect-jupyter/rsconnect_jupyter-${RELEASE_VERSION}.tar.gz ."
sh "pip install --user --upgrade twine==1.15 setuptools wheel"
sh """python -m twine upload \
-u ${PYPI_CREDS_USR} \
-p ${PYPI_CREDS_PSW} \
rsconnect_jupyter-${RELEASE_VERSION}-py2.py3-none-any.whl \
rsconnect_jupyter-${RELEASE_VERSION}.tar.gz \
"""
}
}
}
}