|
1 | 1 | name: Docs |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - branches: |
6 | | - - master |
7 | 4 | push: |
8 | 5 | branches: |
9 | | - - master |
10 | | - - docs/mkdocs |
11 | | - # Disabled until docs support versioning per branch/release |
12 | | - # - develop |
13 | | - release: |
14 | | - types: [published] # update Docs upon new release |
| 6 | + - develop |
15 | 7 |
|
16 | 8 | jobs: |
17 | | - api-docs: |
| 9 | + docs: |
18 | 10 | runs-on: ubuntu-latest |
19 | 11 | steps: |
20 | | - - uses: actions/checkout@v1 |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
21 | 15 | - name: Set up Python |
22 | 16 | uses: actions/setup-python@v1 |
23 | 17 | with: |
24 | 18 | python-version: "3.8" |
25 | | - - uses: actions/setup-node@v1 |
26 | | - with: |
27 | | - node-version: '12' |
28 | | - - name: Capture branch and tag |
29 | | - id: branch_name |
| 19 | + - name: Install dependencies |
| 20 | + run: make dev |
| 21 | + - name: Setup doc deploy |
30 | 22 | run: | |
31 | | - echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV |
32 | | - echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
33 | | - - name: Build docs website |
34 | | - run: make build-docs-website |
35 | | - - name: Build docs API reference |
36 | | - # if: env.SOURCE_BRANCH == 'master' # Disabled until docs support versioning per branch/release |
37 | | - run: make build-docs-api |
| 23 | + git config --global user.name Docs deploy |
| 24 | + git config --global user.email docs@dummy.bot.com |
| 25 | + - name: Build docs website and API reference |
| 26 | + run: make release-docs VERSION="develop" ALIAS="stage" |
38 | 27 | - name: Deploy all docs |
39 | 28 | uses: peaceiris/actions-gh-pages@v3 |
40 | 29 | with: |
41 | 30 | github_token: ${{ secrets.GITHUB_TOKEN }} |
42 | | - publish_dir: ./dist |
43 | | - |
44 | | - # Disabled until docs support versioning per branch/release |
45 | | - # - name: Deploy docs website |
46 | | - # uses: peaceiris/actions-gh-pages@v3 |
47 | | - # with: |
48 | | - # github_token: ${{ secrets.GITHUB_TOKEN }} |
49 | | - # publish_dir: ./dist |
50 | | - # # when deploying docs website only |
51 | | - # # we need to keep existing API docs checked in |
52 | | - # # but only for dev branch |
53 | | - # keep_files: true |
54 | | - # - name: Deploy all docs |
55 | | - # uses: peaceiris/actions-gh-pages@v3 |
56 | | - # if: env.SOURCE_BRANCH == 'master' |
57 | | - # with: |
58 | | - # github_token: ${{ secrets.GITHUB_TOKEN }} |
59 | | - # publish_dir: ./dist |
| 31 | + publish_dir: ./api |
| 32 | + keep_files: true |
| 33 | + destination_dir: develop/api |
| 34 | + - name: Create redirect from old docs |
| 35 | + run: | |
| 36 | + git checkout gh-pages |
| 37 | + test -f 404.html && echo "Redirect already set" && exit 0 |
| 38 | + git checkout develop -- 404.html |
| 39 | + git add 404.html |
| 40 | + git commit -m "chore: set docs redirect" --no-verify |
| 41 | + git push origin gh-pages -f |
0 commit comments