-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: enable versioning feature (#374)
* feat(docs): enable docs versioning * feat: update workflows to support docs versioning * chore: update automated activities note * chore: update to latest mkdocs-material * chore: merge alias redirect in one step * docs: add 404 redirect for old docs * chore: add docs redirect on deploy Signed-off-by: heitorlessa <[email protected]> * chore: enable versioned api ref Signed-off-by: heitorlessa <[email protected]>
- Loading branch information
1 parent
b558b18
commit da3aa5d
Showing
8 changed files
with
165 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,19 @@ name: Publish to PyPi | |
# 7. Kick off Lambda Layer pipeline to publish latest version with extra dependencies as a SAR App | ||
# 8. Builds a fresh version of docs including Changelog updates | ||
# 9. Push latest release source code to master using release title as the commit message | ||
# 10. Builds latest documentation for new release, and update latest alias pointing to the new release tag | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
upload: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
|
@@ -68,8 +71,21 @@ jobs: | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
AWS_DEFAULT_OUTPUT: json | ||
|
||
|
||
- name: Setup doc deploy | ||
run: | | ||
git config --global user.name Docs deploy | ||
git config --global user.email [email protected] | ||
- name: Build docs website and API reference | ||
run: | | ||
make release-docs VERSION=${RELEASE_TAG_VERSION} ALIAS="latest" | ||
poetry run mike set-default --push latest | ||
- name: Deploy all docs | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./api | ||
keep_files: true | ||
destination_dir: ${{ env.RELEASE_TAG_VERSION }}/api | ||
|
||
sync_master: | ||
needs: upload | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,41 @@ | ||
name: Docs | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
- docs/mkdocs | ||
# Disabled until docs support versioning per branch/release | ||
# - develop | ||
release: | ||
types: [published] # update Docs upon new release | ||
- develop | ||
|
||
jobs: | ||
api-docs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: "3.8" | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
- name: Capture branch and tag | ||
id: branch_name | ||
- name: Install dependencies | ||
run: make dev | ||
- name: Setup doc deploy | ||
run: | | ||
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | ||
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Build docs website | ||
run: make build-docs-website | ||
- name: Build docs API reference | ||
# if: env.SOURCE_BRANCH == 'master' # Disabled until docs support versioning per branch/release | ||
run: make build-docs-api | ||
git config --global user.name Docs deploy | ||
git config --global user.email [email protected] | ||
- name: Build docs website and API reference | ||
run: make release-docs VERSION="develop" ALIAS="stage" | ||
- name: Deploy all docs | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./dist | ||
|
||
# Disabled until docs support versioning per branch/release | ||
# - name: Deploy docs website | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: ./dist | ||
# # when deploying docs website only | ||
# # we need to keep existing API docs checked in | ||
# # but only for dev branch | ||
# keep_files: true | ||
# - name: Deploy all docs | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# if: env.SOURCE_BRANCH == 'master' | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: ./dist | ||
publish_dir: ./api | ||
keep_files: true | ||
destination_dir: develop/api | ||
- name: Create redirect from old docs | ||
run: | | ||
git checkout gh-pages | ||
test -f 404.html && echo "Redirect already set" && exit 0 | ||
git checkout develop -- 404.html | ||
git add 404.html | ||
git commit -m "chore: set docs redirect" --no-verify | ||
git push origin gh-pages -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,3 +300,6 @@ wheelhouse | |
docs/.cache/ | ||
docs/public | ||
node_modules | ||
api/ | ||
site/ | ||
!404.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script> | ||
const websitePath = window.location.pathname; | ||
const versionRegex = /(\w.+)\/(latest|([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?)/; | ||
|
||
if (websitePath.search(versionRegex) === -1) { | ||
let projectName = "aws-lambda-powertools-python" | ||
// redirect old links to latest version alias | ||
window.location = websitePath.replace(projectName, `${projectName}/latest`) | ||
} | ||
</script> | ||
</head> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters