Add artifacts upload for website #39
Workflow file for this run
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
name: Documentation | |
on: | |
push: | |
branches: [main] | |
tags: ["*"] | |
pull_request: | |
# Check all PR | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: install dependencies | |
run: | | |
python -m pip install tox | |
- name: build documentation | |
run: tox -e docs | |
- name: put documentation in the website | |
run: | | |
git clone https://github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages | |
rm -rf gh-pages/.git | |
cd gh-pages | |
REF_KIND=$(echo $GITHUB_REF | cut -d / -f2) | |
if [[ "$REF_KIND" == "tags" ]]; then | |
TAG=${GITHUB_REF#refs/tags/} | |
mv ../docs/build/html $TAG | |
else | |
rm -rf latest | |
mv ../docs/build/html latest | |
fi | |
- name: store documentation as github artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: latest/* | |
retention-days: 30 | |
overwrite: true # only keep the latest version of the documentation | |
- name: deploy to gh-pages | |
if: github.event_name == 'push' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./gh-pages/ | |
force_orphan: true |