-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | ||
|
||
jobs: | ||
test_docs: | ||
permissions: | ||
checks: write # for actions/upload-artifact | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 11 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
|
||
- run: pip install mkdocs-material mkdocs-redirects | ||
|
||
- name: Generate Docs | ||
run: ./test_docs.sh | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: docs | ||
path: site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,5 @@ docs/index.md | |
|
||
# jenv | ||
/.java-version | ||
/site/ | ||
/docs/changelogs/changelog.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# The website is built using MkDocs with the Material theme. | ||
# https://squidfunk.github.io/mkdocs-material/ | ||
# It requires Python to run. | ||
# Install the packages with the following command: | ||
# pip install mkdocs mkdocs-material mkdocs-redirects | ||
|
||
set -ex | ||
|
||
# Generate the API docs | ||
./gradlew \ | ||
:mockwebserver:dokkaGfm \ | ||
:okhttp-brotli:dokkaGfm \ | ||
:okhttp-dnsoverhttps:dokkaGfm \ | ||
:logging-interceptor:dokkaGfm \ | ||
:okhttp-sse:dokkaGfm \ | ||
:okhttp-tls:dokkaGfm \ | ||
:okhttp-urlconnection:dokkaGfm \ | ||
:okhttp:dokkaGfm | ||
|
||
# Dokka filenames like `-http-url/index.md` don't work well with MkDocs <title> tags. | ||
# Assign metadata to the file's first Markdown heading. | ||
# https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data | ||
title_markdown_file() { | ||
TITLE_PATTERN="s/^[#]+ *(.*)/title: \1 - OkHttp/" | ||
echo "---" > "$1.fixed" | ||
cat $1 | sed -E "$TITLE_PATTERN" | grep "title: " | head -n 1 >> "$1.fixed" | ||
echo "---" >> "$1.fixed" | ||
echo >> "$1.fixed" | ||
cat $1 >> "$1.fixed" | ||
mv "$1.fixed" "$1" | ||
} | ||
|
||
set +x | ||
for MARKDOWN_FILE in $(find docs/4.x -name '*.md'); do | ||
echo $MARKDOWN_FILE | ||
title_markdown_file $MARKDOWN_FILE | ||
done | ||
set -x | ||
|
||
# Copy in special files that GitHub wants in the project root. | ||
cat README.md | grep -v 'project website' > docs/index.md | ||
cp CHANGELOG.md docs/changelogs/changelog.md | ||
cp CONTRIBUTING.md docs/contribute/contributing.md | ||
|
||
# Build the site locally | ||
mkdocs build |