@@ -8,7 +8,7 @@ plugins {
88 id " com.github.ben-manes.versions" version " 0.11.3"
99 id " com.jfrog.bintray" version " 1.6"
1010 id " org.asciidoctor.convert" version " 1.5.3"
11- id ' org.ajoberstar.github-pages' version ' 1.5.0 '
11+ id ' org.ajoberstar.github-pages' version ' 1.5.1 '
1212 id " com.github.hierynomus.license" version " 0.12.1"
1313 id " net.saliman.properties" version " 1.4.4"
1414 id ' com.gradle.build-receipt' version ' 1.0'
@@ -98,6 +98,7 @@ configurations {
9898}
9999
100100license {
101+ exclude ' *.txt'
101102 header rootProject. file(" license-header.txt" )
102103 skipExistingHeaders true
103104 ignoreFailures false
@@ -107,6 +108,10 @@ signing {
107108 sign configurations. archives
108109}
109110
111+ def isPublishTask (task ) {
112+ task. name. startsWith(' publish' ) && (task. name != ' publishGhPages' )
113+ }
114+
110115signArchives {
111116 onlyIf { gradle .taskGraph .allTasks .findAll {task -> isPublishTask(task)} }
112117}
@@ -179,6 +184,45 @@ artifacts {
179184 (System . getenv(" TRAVIS" ) == " true" ) ? archives(sourcesJar) : archives(sourcesJar, groovydocJar)
180185}
181186
187+ asciidoctor {
188+ sourceDir = file(" doc" )
189+ sources {include ' index.adoc' }
190+ logDocuments = true
191+ attributes ' source-highlighter' : ' coderay' ,
192+ ' coderay-linenums-mode' : ' table' ,
193+ icons : ' font' ,
194+ imagesdir : ' img' ,
195+ ' data-uri' : ' ' ,
196+ linkattrs : true ,
197+ linkcss : true
198+ }
199+ githubPages {
200+ repoUri = ' https://github.com/beryx/handlebars-java-helpers.git'
201+
202+ credentials {
203+ username = System . getenv(' GH_PAGES_ACCESS_TOKEN' )
204+ password = ' '
205+ }
206+
207+ pages {
208+ def pgType = project. hasProperty(' ghPageType' ) ? ghPageType : ' latest'
209+ if (pgType == ' init' ) {
210+ from file(" ghpages" )
211+ } else {
212+ from file(" ${ asciidoctor.outputDir.path} /html5" )
213+ }
214+ def docDir = Boolean . valueOf(hbsHelpersReleaseBuild) ? ' releases' : ' snapshots'
215+ if (pgType == ' init' ) {
216+ into " ."
217+ } else if (pgType == ' version' ) {
218+ publishGhPages. enabled = (docDir != ' snapshots' )
219+ into " $docDir /$hbsHelpersVersion "
220+ } else {
221+ into " $docDir /latest"
222+ }
223+ }
224+ }
225+
182226publishing {
183227 publications {
184228 hbsHelpers(MavenPublication ) {
@@ -275,35 +319,6 @@ ideaWorkspace {
275319 outputFile = file(' hbsHelpers.iws' )
276320}
277321
278- asciidoctor {
279- sourceDir = file(" doc" )
280- sources {include ' index.adoc' }
281- logDocuments = true
282- attributes ' source-highlighter' : ' coderay' ,
283- ' coderay-linenums-mode' : ' table' ,
284- icons : ' font' ,
285- ' data-uri' : ' ' ,
286- linkattrs : true ,
287- linkcss : true
288- }
289-
290- githubPages {
291- repoUri = ' https://github.com/beryx/handlebars-java-helpers.git'
292-
293- credentials {
294- username = System . getenv(' GH_PAGES_ACCESS_TOKEN' )
295- password = ' '
296- }
297-
298- pages {
299- from file(" ${ asciidoctor.outputDir.path} /html5" )
300- from file(' doc/CNAME' )
301- if (! Boolean . valueOf(hbsHelpersReleaseBuild)) {
302- into " snapshots/$hbsHelpersVersion "
303- }
304- }
305- }
306-
307322def readFromConsole (prompt ) {
308323 readFromConsole(' ' , prompt)
309324}
@@ -335,10 +350,6 @@ def readFromConsole(header, prompt, isPassword) {
335350 }
336351}
337352
338- def isPublishTask (task ) {
339- task. name. startsWith(' publish' ) && (task. name != ' publishGhPages' )
340- }
341-
342353gradle. taskGraph. whenReady { taskGraph ->
343354 if (gradle. taskGraph. allTasks. findAll {task -> isPublishTask(task)}) {
344355 def password = readPasswordFromConsole(' Please enter your signing credentials' , ' PGP Private Key Password' )
0 commit comments