Skip to content

Commit 62f56fc

Browse files
committed
improv: build docs on develop branch #49
1 parent 3b4f999 commit 62f56fc

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Diff for: .github/workflows/python_docs.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- master
10+
- develop
1011

1112
jobs:
1213
docs:
@@ -17,10 +18,28 @@ jobs:
1718
uses: actions/setup-python@v1
1819
with:
1920
python-version: "3.8"
21+
- name: Capture branch and tag
22+
id: branch_name
23+
run: |
24+
echo ::set-env name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
25+
echo ::set-env name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
2026
- name: Build docs website
21-
run: make build-docs
22-
- name: Deploy docs
27+
run: make build-docs-website
28+
- name: Build docs API reference
29+
if: env.SOURCE_BRANCH == 'master'
30+
run: make build-docs-api
31+
- name: Deploy docs website
2332
uses: peaceiris/actions-gh-pages@v3
2433
with:
2534
github_token: ${{ secrets.GITHUB_TOKEN }}
2635
publish_dir: ./dist
36+
# when deploying docs website only
37+
# we need to keep existing API docs checked in
38+
# but only for dev branch
39+
keep_files: true
40+
- name: Deploy all docs
41+
uses: peaceiris/actions-gh-pages@v3
42+
if: env.SOURCE_BRANCH == 'master'
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./dist

Diff for: Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ build: pr
2929
poetry run build
3030

3131
build-docs:
32-
mkdir -p dist/api
3332
@$(MAKE) build-docs-website
3433
@$(MAKE) build-docs-api
3534

3635
build-docs-api: dev
36+
mkdir -p dist/api
3737
poetry run pdoc --html --output-dir dist/api/ ./aws_lambda_powertools --force
38-
mv dist/api/aws_lambda_powertools/* dist/api/
38+
mv -f dist/api/aws_lambda_powertools/* dist/api/
3939
rm -rf dist/api/aws_lambda_powertools
4040

4141
build-docs-website: dev-docs
42+
mkdir -p dist
4243
cd docs && npm run build
4344
cp -R docs/public/* dist/
4445

0 commit comments

Comments
 (0)