Skip to content

Commit

Permalink
Build website and generate API docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Feb 20, 2020
1 parent d063926 commit bfa8800
Show file tree
Hide file tree
Showing 21 changed files with 273 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .buildscript/deploy_website.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

set -e

REPO="[email protected]:ReactiveCircus/FlowBinding.git"
REMOTE_NAME="origin"
DIR=temp-clone

if [ -n "${CI}" ]; then
REPO="https://github.com/${GITHUB_REPOSITORY}.git"
fi

# Clone project into a temp directory
rm -rf $DIR
git clone "$REPO" $DIR
cd $DIR

# Generate API docs
./gradlew dokka

# Copy *.md files into docs directory
cp README.md docs/index.md
mkdir -p docs/flowbinding-android && cp flowbinding-android/README.md docs/flowbinding-android/index.md
mkdir -p docs/flowbinding-activity && cp flowbinding-activity/README.md docs/flowbinding-activity/index.md
mkdir -p docs/flowbinding-appcompat && cp flowbinding-appcompat/README.md docs/flowbinding-appcompat/index.md
mkdir -p docs/flowbinding-core && cp flowbinding-core/README.md docs/flowbinding-core/index.md
mkdir -p docs/flowbinding-drawerlayout && cp flowbinding-drawerlayout/README.md docs/flowbinding-drawerlayout/index.md
mkdir -p docs/flowbinding-lifecycle && cp flowbinding-lifecycle/README.md docs/flowbinding-lifecycle/index.md
mkdir -p docs/flowbinding-material && cp flowbinding-material/README.md docs/flowbinding-material/index.md
mkdir -p docs/flowbinding-navigation && cp flowbinding-navigation/README.md docs/flowbinding-navigation/index.md
mkdir -p docs/flowbinding-preference && cp flowbinding-preference/README.md docs/flowbinding-preference/index.md
mkdir -p docs/flowbinding-recyclerview && cp flowbinding-recyclerview/README.md docs/flowbinding-recyclerview/index.md
mkdir -p docs/flowbinding-swiperefreshlayout && cp flowbinding-swiperefreshlayout/README.md docs/flowbinding-swiperefreshlayout/index.md
mkdir -p docs/flowbinding-viewpager2 && cp flowbinding-viewpager2/README.md docs/flowbinding-viewpager2/index.md
cp CHANGELOG.md docs/changelog.md

# If on CI, configure git remote with access token
if [ -n "${CI}" ]; then
REMOTE_NAME="https://x-access-token:${DEPLOY_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote add deploy "$REMOTE_NAME"
git fetch deploy && git fetch deploy gh-pages:gh-pages
fi

# Build the website and deploy to GitHub Pages
mkdocs gh-deploy --remote-name "$REMOTE_NAME"

# Delete temp directory
cd ..
rm -rf $DIR
30 changes: 30 additions & 0 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Website

on:
push:
branches:
- master
paths:
- '**.md'
- 'mkdocs.yml'

jobs:
deploy-website:
name: Generate API docs and deploy website
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: |
pip3 install mkdocs mkdocs-material mkdocs-minify-plugin pymdown-extensions
.buildscript/deploy_website.sh
env:
CI: true
JAVA_TOOL_OPTIONS: -Xmx3g
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Dkotlin.incremental=false -Dkotlin.compiler.execution.strategy=in-process
DEPLOY_TOKEN: ${{ secrets.GH_DEPLOY_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ captures/

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Docs
site
docs/api
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ buildscript {
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${versions.detekt}"
classpath "com.vanniktech:gradle-maven-publish-plugin:${versions.mavenPublishPlugin}"
classpath "io.github.reactivecircus.firestorm:firestorm-gradle-plugin:${versions.firestormGradlePlugin}"
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}")
}
}

Expand Down
1 change: 1 addition & 0 deletions buildSrc/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.ext.versions = [
androidLint : '27.0.0-alpha09',
mavenPublishPlugin : '0.9.0',
firestormGradlePlugin: '0.1.1',
dokka : '0.10.1',
kotlin : '1.3.61',
detekt : '1.5.1',
kotlinx : [
Expand Down
Binary file added docs/images/reactive_cirrus_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions flowbinding-activity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-appcompat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-drawerlayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-lifecycle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-material/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-navigation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-preference/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-recyclerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-swiperefreshlayout/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
8 changes: 8 additions & 0 deletions flowbinding-viewpager2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ plugins {
id 'kotlin-android'
id 'com.vanniktech.maven.publish'
id 'io.github.reactivecircus.firestorm'
id 'org.jetbrains.dokka'
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
outputFormat = 'gfm'
}
}

android {
Expand Down
82 changes: 82 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
site_name: 'FlowBinding'
site_description: "Kotlin Coroutines Flow binding APIs for Android's platform and unbundled UI widgets, inspired by RxBinding."
site_author: 'Yang Chen'
site_url: 'https://reactivecircus.github.io/FlowBinding'
remote_branch: gh-pages

repo_name: 'FlowBinding'
repo_url: 'https://github.com/ReactiveCircus/FlowBinding'

copyright: 'Copyright © 2019 Yang Chen'

theme:
name: 'material'
language: 'en'
favicon: 'images/reactive_cirrus_logo.png'
logo: 'images/reactive_cirrus_logo.png'
palette:
primary: 'white'
accent: 'white'
font:
text: 'Fira Sans'
code: 'Fira Code'

extra:
social:
- type: 'github'
link: 'https://github.com/ReactiveCircus/FlowBinding'

nav:
- 'Overview': index.md
- 'Platform Bindings': flowbinding-android/index.md
- 'AndroidX Activity Bindings': flowbinding-activity/index.md
- 'AndroidX AppCompat Bindings': flowbinding-appcompat/index.md
- 'AndroidX Core Bindings': flowbinding-core/index.md
- 'AndroidX DrawerLayout Bindings': flowbinding-drawerlayout/index.md
- 'AndroidX Lifecycle Bindings': flowbinding-lifecycle/index.md
- 'AndroidX Navigation Component Bindings': flowbinding-navigation/index.md
- 'AndroidX Preference Bindings': flowbinding-preference/index.md
- 'AndroidX RecyclerView Bindings': flowbinding-recyclerview/index.md
- 'AndroidX SwipeRefreshLayout Bindings': flowbinding-swiperefreshlayout/index.md
- 'AndroidX ViewPager2 Bindings': flowbinding-viewpager2/index.md
- 'Material Components Bindings': flowbinding-material/index.md
- 'Change Log': changelog.md
- 'API':
- 'flowbinding-activity': api/flowbinding-activity/index.md
- 'flowbinding-android': api/flowbinding-android/index.md
- 'flowbinding-appcompat': api/flowbinding-appcompat/index.md
- 'flowbinding-common': api/flowbinding-common/index.md
- 'flowbinding-core': api/flowbinding-core/index.md
- 'flowbinding-drawerlayout': api/flowbinding-drawerlayout/index.md
- 'flowbinding-lifecycle': api/flowbinding-lifecycle/index.md
- 'flowbinding-material': api/flowbinding-material/index.md
- 'flowbinding-navigation': api/flowbinding-navigation/index.md
- 'flowbinding-preference': api/flowbinding-preference/index.md
- 'flowbinding-recyclerview': api/flowbinding-recyclerview/index.md
- 'flowbinding-swiperefreshlayout': api/flowbinding-swiperefreshlayout/index.md
- 'flowbinding-viewpager2': api/flowbinding-viewpager2/index.md

markdown_extensions:
- admonition
- smarty
- codehilite:
guess_lang: false
linenums: True
- footnotes
- meta
- toc:
permalink: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.details
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.smartsymbols
- pymdownx.superfences
- tables

plugins:
- search
- minify:
minify_html: true

0 comments on commit bfa8800

Please sign in to comment.