generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 150
68 lines (62 loc) · 2.02 KB
/
mk-docs-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build mkdocs
on:
pull_request:
branches: [master]
push:
branches: [master]
release:
types: [created]
env:
SITE_BRANCH: ${{ 'gh-pages-ver' }}
jobs:
build-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install package
run: pip install -e .[dev]
- name: Prepare the docs
run: |
cd docs
python autogen.py
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Build the docs locally only
if: github.event_name == 'pull_request'
run: |
cd docs
mike deploy dev -b ${{ env.SITE_BRANCH }}
- name: Deploy dev docs
id: deploy_dev
if: github.repository == 'airctic/icevision' && github.event_name == 'push'
run: |
cd docs
mike deploy dev -b ${{ env.SITE_BRANCH }} -p
echo '::set-output name=MIKE_VERSIONS::'$(mike list -b ${{ env.SITE_BRANCH }} | wc -l)
- name: Set dev as default
if: steps.deploy_dev.outputs.MIKE_VERSIONS == 1
run: |
cd docs
mike set-default -b ${{ env.SITE_BRANCH }} dev -p
- name: Get latest release tag
if: github.event_name == 'release' && !github.event.release.prerelease
id: latest
uses: pozetroninc/github-action-get-latest-release@master
with:
excludes: prerelease
repository: ${{ github.repository }}
- name: Release docs
if: github.event_name == 'release' && !github.event.release.prerelease
run: |
cd docs
echo Deploy as ${{ steps.latest.outputs.release }}
mike deploy -b ${{ env.SITE_BRANCH }} ${{ steps.latest.outputs.release }} -p
mike set-default -b ${{ env.SITE_BRANCH }} ${{ steps.latest.outputs.release }} -p