Skip to content

Commit

Permalink
add netlify docs deploy (#27)
Browse files Browse the repository at this point in the history
* add netlify docs deploy

* remove tests from install

* activate venv before building docs\

* change build

* dont pass SITE_URL env if build on master

* split docs build for preview and master
  • Loading branch information
nsidnev authored Mar 14, 2020
1 parent d7c07c2 commit 322326d
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 28 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy-docs-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Deploy to GitHub Pages

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/cache@v1
id: cache-poetry
with:
path: ~/.cache/pip
key: get-poetry-${{ runner.os }}-py-${{ matrix.python-version }}
restore-keys: |
get-poetry-${{ runner.os }}-py-
get-poetry-${{ runner.os }}-
- name: Install poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
pip install poetry==1.0
poetry config virtualenvs.in-project true
- uses: actions/cache@v1
id: cache-deps-extras
with:
path: .venv
key: venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
venv-${{ runner.os }}-py-${{ matrix.python-version }}-
venv-${{ runner.os }}-py-
venv-${{ runner.os }}-
- name: Install dependencies
if: steps.cache-deps-extras.outputs.cache-hit != 'true'
run: |
poetry install --extras docs
- name: Build MkDocs for GitHub Pages
run: |
source .venv/bin/activate
./scripts/build-docs
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.0.3
with:
publish-dir: './site'
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
60 changes: 60 additions & 0 deletions .github/workflows/deploy-docs-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Deploy to Netlify for Preview

on:
pull_request:
types:
- opened
- synchronize

env:
SITE_URL: https://pybotx.netlify.com

jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/cache@v1
id: cache-poetry
with:
path: ~/.cache/pip
key: get-poetry-${{ runner.os }}-py-${{ matrix.python-version }}
restore-keys: |
get-poetry-${{ runner.os }}-py-
get-poetry-${{ runner.os }}-
- name: Install poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
pip install poetry==1.0
poetry config virtualenvs.in-project true
- uses: actions/cache@v1
id: cache-deps-extras
with:
path: .venv
key: venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
venv-${{ runner.os }}-py-${{ matrix.python-version }}-
venv-${{ runner.os }}-py-
venv-${{ runner.os }}-
- name: Install dependencies
if: steps.cache-deps-extras.outputs.cache-hit != 'true'
run: |
poetry install --extras docs
- name: Build MkDocs for Netlify
run: |
source .venv/bin/activate
./scripts/build-docs
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.0.3
with:
publish-dir: './site'
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ This bot will send back every your message.

## License

This project is licensed under the terms of the MIT license.
This project is licensed under the terms of the MIT license.
54 changes: 27 additions & 27 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
site_name: pybotx
site_url: https://expressapp.github.io/pybotx
site_url: !!python/object/apply:os.getenv ["SITE_URL", "https://expressapp.github.io/pybotx"]
site_description: A little python library for building bots for Express

theme:
name: 'material'
name: 'material'

repo_name: ExpressApp/pybotx
repo_url: https://github.com/ExpressApp/pybotx
edit_uri: ''

nav:
- Introduction: 'index.md'
- Tutorial - User Guide:
- First Steps: 'development/first-steps.md'
- Sending Messages And Files: 'development/sending-data.md'
- Handlers Collecting: 'development/collector.md'
- Handling Errors: 'development/handling-errors.md'
- Dependencies Injection: 'development/dependencies-injection.md'
- Logging: 'development/logging.md'
- Testing: 'development/tests.md'
- API Reference:
- Bots: 'reference/bots.md'
- Clients: 'reference/clients.md'
- Collecting: 'reference/collecting.md'
- Exceptions: 'reference/exceptions.md'
- Testing: 'reference/testing.md'
- Models: 'reference/models.md'
- Dependencies: 'reference/dependencies.md'
- Middlewares: 'reference/middlewares.md'
- Changelog: 'changelog.md'
- Introduction: 'index.md'
- Tutorial - User Guide:
- First Steps: 'development/first-steps.md'
- Sending Messages And Files: 'development/sending-data.md'
- Handlers Collecting: 'development/collector.md'
- Handling Errors: 'development/handling-errors.md'
- Dependencies Injection: 'development/dependencies-injection.md'
- Logging: 'development/logging.md'
- Testing: 'development/tests.md'
- API Reference:
- Bots: 'reference/bots.md'
- Clients: 'reference/clients.md'
- Collecting: 'reference/collecting.md'
- Exceptions: 'reference/exceptions.md'
- Testing: 'reference/testing.md'
- Models: 'reference/models.md'
- Dependencies: 'reference/dependencies.md'
- Middlewares: 'reference/middlewares.md'
- Changelog: 'changelog.md'

markdown_extensions:
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite

plugins:
- search
Expand Down

0 comments on commit 322326d

Please sign in to comment.