-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated workflow to generate docs on each push
- Loading branch information
1 parent
f7d1424
commit 1693cbd
Showing
1 changed file
with
19 additions
and
30 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 |
---|---|---|
@@ -1,46 +1,35 @@ | ||
name: website | ||
|
||
# build the documentation whenever there are new commits on main | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
# security: restrict permissions for CI jobs. | ||
permissions: | ||
contents: read | ||
- staging | ||
|
||
jobs: | ||
# Build the documentation and upload the static HTML files as an artifact. | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
- name: Run `pdoc` on current branch `master`/`live` | ||
run: | | ||
TEMP_DOCS_DIR=$(mktemp -d) | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry install | ||
poetry run pdoc tradingview_screener/ -o $TEMP_DOCS_DIR | ||
# install all dependencies (including pdoc) | ||
- run: curl -sSL https://install.python-poetry.org | python3 - | ||
- run: poetry install | ||
# build your documentation into docs/. | ||
- run: poetry run pdoc tradingview_screener/ -o docs/ | ||
|
||
- uses: actions/upload-pages-artifact@v1 | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: docs/ | ||
|
||
# Deploy the artifact to GitHub pages. | ||
# This is a separate job so that only actions/deploy-pages has the necessary permissions. | ||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- id: deployment | ||
uses: actions/deploy-pages@v2 | ||
ref: docs | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Move generated docs from temp directory to branch `docs`, and commit | ||
run: | | ||
mkdir -p ./docs/latest | ||
cp -r "${TEMP_DOCS_DIR}/." ./docs/latest | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git commit -a -m "Generated docs for latest dev version" | ||
git status | ||
git push |