@@ -217,3 +217,39 @@ ext.NODE = { ...cmd ->
217217 return res;
218218}
219219
220+ /**
221+ * Publish docs to lsst.io
222+ */
223+ ext.publishDocs = { docsDir, product ->
224+
225+ def branch = System.env.BRANCH ?: "master"
226+ docsDir = docsDir ?: "${warDir}/docs"
227+ product = product ?: "firefly"
228+
229+ if (!file(docsDir).exists()) {
230+ println ">> docs directory does not exists. Skipping publishDocs."
231+ throw new StopExecutionException("docs directory does not exists. Skipping publishDocs.")
232+ }
233+
234+ try {
235+ "ltd-mason-travis -h".execute()
236+ } catch (Exception e) {
237+ println ">> ltd-mason-travis is not installed. Task cannot continue."
238+ throw new GradleException("ltd-mason-travis is not installed. Task cannot continue.\"", e)
239+ }
240+
241+ def res = exec {
242+ environment 'LTD_MASON_BUILD': 'true'
243+ environment 'LTD_MASON_PRODUCT': product
244+ environment 'LTD_MASON_AWS_ID': 'AKIAJRVDEID2GE6GLL7Q'
245+ environment 'LTD_MASON_AWS_SECRET': project.appConfigProps['LTD_MASON_AWS_SECRET']
246+ environment 'LTD_KEEPER_URL': 'https://keeper.lsst.codes'
247+ environment 'LTD_KEEPER_USER': 'firefly'
248+ environment 'LTD_KEEPER_PASSWORD': project.appConfigProps['LTD_KEEPER_PASSWORD']
249+ environment 'TRAVIS_PULL_REQUEST': 'false'
250+ environment 'TRAVIS_REPO_SLUG': 'Caltech-IPAC/firefly'
251+ environment 'TRAVIS_BRANCH': branch
252+ commandLine "ltd-mason-travis", "--html-dir", docsDir
253+ }
254+ return res
255+ }
0 commit comments