Skip to content

Add deploy task for gh-pages #2

Add deploy task for gh-pages

Add deploy task for gh-pages #2

Workflow file for this run

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: 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
- if: github.event_name == 'pull_request'
name: Post link to RTD
uses: readthedocs/actions/preview@v1
with:
project-slug: "software-cookbook"