Skip to content

Commit

Permalink
Add publishing of versioned documentation on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hoshiyosan committed Dec 13, 2022
1 parent 587d670 commit 626903d
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,20 @@ jobs:
- name: Build and publish
if: success()
run: docker buildx build --platform linux/amd64,linux/arm64 --output type=image,push=true -t ${{env.DOCKER_REGISTRY_URL}}/${{env.DOCKER_ORG_NAME}}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} -t ${{ env.DOCKER_REGISTRY_URL }}/${{ env.DOCKER_ORG_NAME }}/${{ env.DOCKER_IMAGE_NAME }}:latest .

publish-documentation:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: "Setup Python"
uses: actions/setup-python@v4.3.1
with:
python-version: 3.11

- name: "Install docs dependencies"
run: pip install -r requirements/docs.txt

- name: "Build doc and update github pages"
run: mike deploy --push --update-aliases ${{ env.DOCKER_IMAGE_TAG }} latest
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.6"

services:
shopeat-api:
image: shopeat
image: sylvanld/shopeat
command: api-start
environment:
SHOPEAT_API_HOST: "0.0.0.0"
Expand All @@ -14,7 +14,7 @@ services:
- 8000:8000

shopeat-notifier:
image: shopeat
image: sylvanld/shopeat
command: notifier-start
environment:
SHOPEAT_NOTIFIER_HOST: 0.0.0.0
Expand Down
57 changes: 57 additions & 0 deletions docs/docker-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Shopeat docker image

```
docker pull sylvanld/shopeat:{imageTag}
```

Have a look at dockerhub to find [available image tags](https://hub.docker.com/r/sylvanld/shopeat/tags).

### Example usage with docker-compose

```yaml
version: "3.6"

services:
shopeat-api:
image: sylvanld/shopeat
command: api-start
environment:
SHOPEAT_API_HOST: "0.0.0.0"
SHOPEAT_API_PORT: 8000
SHOPEAT_AMQP_BROKER_URL: amqp://rabbit:password@rabbitmq
SHOPEAT_JWT_SECRET: tartampion
SHOPEAT_DATABASE_URL: "postgresql+asyncpg://postgres:password@database/shopeat"
ports:
- 8000:8000

shopeat-notifier:
image: sylvanld/shopeat
command: notifier-start
environment:
SHOPEAT_NOTIFIER_HOST: 0.0.0.0
SHOPEAT_NOTIFIER_PORT: 7000
SHOPEAT_JWT_SECRET: tartampion
SHOPEAT_AMQP_BROKER_URL: amqp://rabbit:password@rabbitmq
ports:
- 7000:7000
restart: always

database:
image: postgres:alpine3.17
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
restart: always

rabbitmq:
image: rabbitmq:3-management
ports:
- 5672:5672
- 15672:15672
environment:
RABBITMQ_DEFAULT_USER: rabbit
RABBITMQ_DEFAULT_PASS: password
restart: always
```
17 changes: 17 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Welcome to MkDocs

For full documentation visit [mkdocs.org](https://www.mkdocs.org).

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
9 changes: 9 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
site_name: ShopEat
theme:
name: material
plugins:
- mike:
extra:
version:
default: 0.0.1
provider: mike
4 changes: 4 additions & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mkdocs>=1.4.2
mkdocs-material>=8.5.11
mkdocs-material-extensions>=1.1.1
mike>=1.1.2
9 changes: 9 additions & 0 deletions shopeat/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ def CLI():
...


@CLI.command("api-specs")
@click.option("--pretty", is_flag=True, help="Properly indent JSON to make it human readable")
def print_openapi_schema(pretty: bool):
import json
import shopeat.api.asgi
indent = 4 if pretty else None
print(json.dumps(shopeat.api.asgi.app.openapi(), indent=indent))


@CLI.command("api-start")
def start_api():
import uvicorn
Expand Down

0 comments on commit 626903d

Please sign in to comment.