Skip to content

Commit

Permalink
docs: docs about docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukegalbraithrussell committed Aug 6, 2024
1 parent 1450f58 commit 706019a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 31 deletions.
6 changes: 2 additions & 4 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,20 @@ $ ./scripts/run_integration_tests.sh integration_tests/web/test_async_web_client

### Generating Documentation

See `/docs/README` for information on editing documentation pages.
See [`/docs/README`](https://github.com/slackapi/python-slack-sdk/blob/main/docs/README.md) for information on editing documentation pages.

The API reference is generated from a script. You can generate and preview the **API _reference_ documents for `slack_sdk` package modules** by running:

```bash
$ ./scripts/generate_api_docs.sh
```

Then run the "Deploy to GitHub Pages" workflow.

### Releasing

1. Create the commit for the release:

- Bump the version number in adherence to [Semantic Versioning](http://semver.org/) in `slack_sdk/version.py`.
- Build the docs with `./scripts/docs.sh` and then `./scripts/generate_api_docs.sh`.
- Build the reference docs with `./scripts/generate_api_docs.sh`.
- Create a branch for the release with `git checkout -b v2.5.0`
- Make a commit that includes the new version number: `git commit -a -m 'version 2.5.0'`.
- Open a PR and merge after receiving at least one approval from other maintainers.
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy to GitHub Pages

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

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: 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
34 changes: 7 additions & 27 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# slack.dev/bolt-python
# slack.dev/python-slack-sdk

This website is built using [Docusaurus](https://docusaurus.io/). 'Tis cool.

Each Bolt/SDK has its own Docusaurus website, with matching CSS and nav/footer. There is also be a Docusaurus website of just the homepage and community tools.

```
website/
├── docs/ (the good stuff. md and mdx files supported)
├── docs/ (the good stuff. md/mdx files supported)
│ ├── getting-started.md
│ └── concepts
│ └── sending-message.md
├── i18n/ja/ (the japanese translations)
│ ├──docusaurus-theme-classic/ (footer/navbar translations)
│ └──docusaurus-plugin-content-docs/
│ └── current/ ( file names need to exactly match **/docs/, but japanese content)
│ ├── getting-started.md
│ └── concepts
│ └── sending-message.md
├── static/
│ ├── css/
│ │ └── custom.css (the css for everything!)
Expand All @@ -25,7 +18,7 @@ website/
│ │ └── oslo.svg
│ └── api-docs/slack_bolt (the generated reference docs with their own HTML/CSS)
│ ├── index.html
│ └── adaptor
│ └── audit_logs
│ └── index.html
├── src/
│ ├── pages/ (stuff that isn't docs. This is empty for this repo!)
Expand All @@ -36,7 +29,6 @@ website/

A cheat-sheet:
* _I want to edit a doc._ `docs/*/*.md`
* _I want to edit a Japanese doc._ `i18n/ja-jp/docusaurus-plugin-content-docs/current/*/*.md`. See the [Japanese docs README](./docs/README.md)
* _I want to change the docs sidebar._ `sidebar.js`
* _I want to change the css._ Don't use this repo, use the home repo and the changes will propagate here.
* _I want to change anything else._ `docusaurus.config.js`
Expand All @@ -47,9 +39,8 @@ A cheat-sheet:

1. Make a markdown file. Add a `# Title` or use [front matter](https://docusaurus.io/docs/next/create-doc) with `title:`.
2. Save it in `docs/folder/title.md` or `docs/title.md`, depending on if it's in a sidebar category. The nuance is just for internal organization.
3. There needs to be 1:1 docs for the sidebar. Copy the folder/file and put it in the Japanese docs: `i18n/ja/docusaurus-plugin-content-docs/current/*`. Just leave it in English if you don't speak Japanese.
4. Add the doc's path to the sidebar within `docusaurus.config.js`. Where ever makes most sense for you.
5. Test the changes ↓
3. Add the doc's path to the sidebar within `docusaurus.config.js`. Where ever makes most sense for you.
4. Test the changes ↓

---

Expand Down Expand Up @@ -82,20 +73,9 @@ The following command starts a local development server and opens up a browser w
npm run start
```

Edits to pages are reflected live — no restarting the server or reloading the page. (I'd say... 95% of the time, and 100% time if you're just editing a markdown file). The generated reference docs only load in prod!

Remember — you're only viewing the Bolt for Python docs right now.

#### Running locally in Japanese

For local runs, Docusaurus treats each language as a different instance of the website. You'll want to specify the language to run the japanese site locally:

```
npm run start -- --locale ja-jp
```

Don't worry - both languages will be built/served on deployment.
Edits to pages are reflected live — no restarting the server or reloading the page. (I'd say... 95% of the time, and 100% time if you're just editing a markdown file). FYI: The generated reference docs only load on build!

Remember — you're only viewing the Python Slack SDK docs right now.
---

## Deploying
Expand Down

0 comments on commit 706019a

Please sign in to comment.