Skip to content

Commit

Permalink
add list of releases
Browse files Browse the repository at this point in the history
  • Loading branch information
siordache committed Dec 15, 2017
1 parent 707304e commit b139006
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cache:
directories:
- $HOME/.gradle

before_install:
install:
- chmod a+x ./travis-build.sh
- chmod a+x ./gradlew

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ You can also use a web-based terminal, which allows you to access your applicati

<a href="https://github.com/beryx/text-io/raw/master/doc/img/web-terminal-animated.gif"><img src="https://github.com/beryx/text-io/raw/master/doc/img/web-terminal-thumb.gif"></a>

Before starting to use the library read the **[documentation](http://text-io.beryx.org)** and the **[javadoc](http://text-io.beryx.org/releases/latest/javadoc)**.
Also, take a look at the list of **[demos, examples and projects](https://github.com/beryx/text-io/wiki/Demos,-Examples-and-Projects-using-Text-IO)** using Text-IO.
**Useful links**
- [Documentation](http://text-io.beryx.org)
- [javadoc](http://text-io.beryx.org/releases/latest/javadoc)
- [Demos, examples and projects using Text-IO](https://github.com/beryx/text-io/wiki/Demos,-Examples-and-Projects-using-Text-IO)
- [List of all releases](https://github.com/beryx/text-io/blob/gh-pages/releases.md)

Text-IO is available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.beryx%22%20AND%20a%3A%22text-io%22) and [JCenter](https://bintray.com/beryx/maven/text-io).
74 changes: 73 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

import groovy.text.SimpleTemplateEngine
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.plugins.signing.Sign
import org.kohsuke.github.*

buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.kohsuke:github-api:1.90'
}
}

plugins {
id 'java'
Expand Down Expand Up @@ -235,13 +248,21 @@ gitPublish {
def pgType = project.hasProperty('ghPageType') ? ghPageType : 'latest'
if(pgType == 'init') {
from file("ghpages")
} else if(pgType == 'list') {
from file("build/release-list")
} else {
from file("${asciidoctor.outputDir.path}/html5")
from file("build/docs")
}
def docDir = Boolean.valueOf(textIoReleaseBuild) ? 'releases' : 'snapshots'
if(pgType == 'init') {
into "."
} else if(pgType == 'list') {
into "."
preserve {
include '**'
exclude "releases.md"
}
} else if(pgType == 'version') {
gitPublishPush.enabled = (docDir != 'snapshots')
into "$docDir/$textIoVersion"
Expand Down Expand Up @@ -338,6 +359,57 @@ def configureJavadoc(task) {
}
}

task "update-release-list" {
doLast {
def docBaseUrl = 'https://beryx.github.io/text-io'
updateReleaseList(docBaseUrl)
}
}

def updateReleaseList(String docBaseUrl) {
List<String> releases = getReleases()
def markdown = getReleasesMarkdown(releases, docBaseUrl)
def releaseListDir = new File('build/release-list')
releaseListDir.mkdirs()
new File(releaseListDir, 'releases.md').write(markdown)
}

def getReleases() {
GitHub gitHubApi = GitHub.connectUsingPassword(System.getenv('GH_PAGES_ACCESS_TOKEN') ?: '', '')
def releases = gitHubApi.getOrganization("beryx")
.getRepository("text-io")
.getDirectoryContent("releases", "gh-pages")*.name
releases.removeAll { !it || it == 'latest' }
releases.reverse()
}

def getReleasesMarkdown(List<String> releases, String docBaseUrl) {
def releasesTemplate = '''
## List of all releases ##
**Latest snapshot**
- [documentation]($docBaseUrl/snapshots/latest)
- [javadoc]($docBaseUrl/snapshots/latest/javadoc)
<% releases.each { %>**Release $it**
- [documentation]($docBaseUrl/releases/$it)
- [javadoc]($docBaseUrl/releases/$it/javadoc)
<% } %>
'''.stripIndent()

def engine = new SimpleTemplateEngine()
def template = engine.createTemplate(releasesTemplate)
def binding = [
docBaseUrl: docBaseUrl,
releases : releases
]

template.make(binding).toString()
}



def readFromConsole(prompt) {
readFromConsole('', prompt)
}
Expand Down
8 changes: 6 additions & 2 deletions travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ if [ "${TRAVIS_PULL_REQUEST}" == "false" -a "${TRAVIS_BRANCH}" == "master" ]; th
echo Finished gitPublishPush with ghPageType=version

echo Start gitPublishPush with ghPageType=version
./gradlew --no-daemon -i -s gitPublishPush --rerun-tasks -PghPageType=version
echo Finished gitPublishPush with ghPageType=version
./gradlew --no-daemon -i -s gitPublishPush --rerun-tasks -PghPageType=version
echo Finished gitPublishPush with ghPageType=version

echo Start updating releases.md
./gradlew --no-daemon -i -s update-release-list gitPublishPush --rerun-tasks -PghPageType=list
echo Finished updating releases.md
fi

0 comments on commit b139006

Please sign in to comment.