Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: adds docusaurus site #1342

Merged
merged 11 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ By installing App(2) and App(3), you get the followings. Set them as env variabl

### Generating Documentation

The documentation is built using [Jekyll](https://jekyllrb.com/) and hosted with GitHub Pages. The source files are
contained in the `docs` directory. Reading the Jekyll configuration in `docs/_config.yml` is helpful to understand how
the documentation is organized and built.

Refer to the [README](https://github.com/slackapi/java-slack-sdk/blob/master/docs/README.md) for details.
Refer to the [README](https://github.com/slackapi/java-slack-sdk/blob/main/docs/README.md) for details on editing documentation.

### Releasing

Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/docs-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Implement docs site

on:
pull_request:
branches:
- main
paths:
- 'docs/**'
push:
branches:
- main
paths:
- 'docs/**'
workflow_dispatch:

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: docs/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: ./docs

- name: Read version from docs/version-config.yml
id: read_version
run: |
sdkLatestVersionValue=$(grep 'sdkLatestVersion:' docs/version-config.yml | awk '{print $2}')
okhttpVersionValue=$(grep 'okhttpVersion:' docs/version-config.yml | awk '{print $2}')
slf4jApiVersionValue=$(grep 'slf4jApiVersion:' docs/version-config.yml | awk '{print $2}')
kotlinVersionValue=$(grep 'kotlinVersion:' docs/version-config.yml | awk '{print $2}')
helidonVersionValue=$(grep 'helidonVersion:' docs/version-config.yml | awk '{print $2}')
javaxWebsocketApiVersionValue=$(grep 'javaxWebsocketApiVersion:' docs/version-config.yml | awk '{print $2}')
springBootVersionValue=$(grep 'springBootVersion:' docs/version-config.yml | awk '{print $2}')
compatibleMicronautVersionValue=$(grep 'compatibleMicronautVersion:' docs/version-config.yml | awk '{print $2}')
quarkusVersionValue=$(grep 'quarkusVersion:' docs/version-config.yml | awk '{print $2}')
tyrusStandaloneClientVersionValue=$(grep 'tyrusStandaloneClientVersion:' docs/version-config.yml | awk '{print $2}')
echo "sdkLatestVersion=$sdkLatestVersionValue" >> $GITHUB_ENV
echo "okhttpVersion=$okhttpVersionValue" >> $GITHUB_ENV
echo "slf4jApiVersion=$slf4jApiVersionValue" >> $GITHUB_ENV
echo "kotlinVersion=$kotlinVersionValue" >> $GITHUB_ENV
echo "helidonVersion=$helidonVersionValue" >> $GITHUB_ENV
echo "javaxWebsocketApiVersion=$javaxWebsocketApiVersionValue" >> $GITHUB_ENV
echo "springBootVersion=$springBootVersionValue" >> $GITHUB_ENV
echo "compatibleMicronautVersion=$compatibleMicronautVersionValue" >> $GITHUB_ENV
echo "quarkusVersion=$quarkusVersionValue" >> $GITHUB_ENV
echo "tyrusStandaloneClientVersion=$tyrusStandaloneClientVersionValue" >> $GITHUB_ENV

- name: Replace placeholders in .md files
run: |
DOCS_DIR="./docs/content"
find $DOCS_DIR -name "*.md" | while read file; do
sed -i "s/sdkLatestVersion/${{ env.sdkLatestVersion }}/g" "$file"
sed -i "s/okhttpVersion/${{ env.okhttpVersion }}/g" "$file"
sed -i "s/slf4jApiVersion/${{ env.slf4jApiVersion }}/g" "$file"
sed -i "s/kotlinVersion/${{ env.kotlinVersion }}/g" "$file"
sed -i "s/helidonVersion/${{ env.helidonVersion }}/g" "$file"
sed -i "s/javaxWebsocketApiVersion/${{ env.javaxWebsocketApiVersion }}/g" "$file"
sed -i "s/springBootVersion/${{ env.springBootVersion }}/g" "$file"
sed -i "s/compatibleMicronautVersion/${{ env.compatibleMicronautVersion }}/g" "$file"
sed -i "s/quarkusVersion/${{ env.quarkusVersion }}/g" "$file"
sed -i "s/tyrusStandaloneClientVersion/${{ env.tyrusStandaloneClientVersion }}/g" "$file"
done
- name: Build website
run: npm run build
working-directory: ./docs

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build

deploy:
name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # verifies deployment is from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
7 changes: 3 additions & 4 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_site
.env
.jekyll-metadata
vendor/
node_modules/
.docusaurus
build
1 change: 0 additions & 1 deletion docs/.ruby-version

This file was deleted.

2 changes: 0 additions & 2 deletions docs/Gemfile

This file was deleted.

Loading