Skip to content

Commit a11f45b

Browse files
Massimiliano Pippimasci
authored andcommitted
publish dev and versioned docs
1 parent a94c7a5 commit a11f45b

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/docs.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
push:
1515
branches:
1616
- master
17+
# release branches have names like 0.8.x, 0.9.x, ...
18+
- '[0-9]+.[0-9]+.x'
1719
# At this day, GitHub doesn't support YAML anchors, d'oh!
1820
paths:
1921
- 'docs/**'
@@ -24,6 +26,8 @@ on:
2426
jobs:
2527
build:
2628
runs-on: ubuntu-latest
29+
env:
30+
REMOTE: https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git
2731

2832
steps:
2933
- name: Checkout
@@ -69,12 +73,17 @@ jobs:
6973
python3 -m pip install -r ./requirements_docs.txt
7074
7175
- name: Build docs website
76+
# this runs on every PR to ensure the docs build is sane
77+
if: github.event_name == 'pull_request'
7278
run: task docs:build
7379

74-
- name: Deploy
75-
# publish docs only when PR is merged on master
76-
if: github.event_name == 'push'
77-
uses: peaceiris/actions-gh-pages@v3
78-
with:
79-
github_token: ${{ secrets.GITHUB_TOKEN }}
80-
publish_dir: ./public
80+
- name: Publish dev docs
81+
# dev docs are published every time a commit is pushed to master
82+
if: github.event_name == 'push' && github.ref == 'master'
83+
run: task docs:publish DOCS_REMOTE=$REMOTE DOCS_VERSION=dev
84+
85+
- name: Publish versioned docs
86+
# versioned docs are published every time a commit is pushed to
87+
# a release branch
88+
if: github.event_name == 'push' && github.ref != 'master'
89+
run: task docs:publish DOCS_REMOTE=$REMOTE DOCS_VERSION=${{github.ref}}

0 commit comments

Comments
 (0)