name: website-from-source
on:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
python-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Get rust version
id: versions
run: |
version=$(rustc --version | awk '{ print $2 }')
echo "Found version: $version"
echo "rustc=$version" >> $GITHUB_OUTPUT
- name: Cache Rust dependencies
uses: actions/cache@v2
with:
path: |
target
.cargo_home
.cargo
key: ${{ runner.os }}-pybindings-rust-${{ steps.versions.outputs.rustc }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-pybindings-rust-${{ steps.versions.outputs.rustc }}-
- name: checkout website template
run: |
git clone https://github.com/bamler-lab/constriction.git --branch website-template --single-branch website
rm -rf website/.git
CONSTRICTION_VERSION=`poetry run python get_version.py`
echo "Found constriction version $CONSTRICTION_VERSION."
sed -i "s/<\!-- CONSTRICTION_VERSION -->/$CONSTRICTION_VERSION/g" website/index.html
- name: generate license file
run: |
cargo install cargo-about
cargo about generate --features=pybindings about.hbs > website/license.html
wc -l website/license.html
- name: generate python API reference
run: |
poetry run maturin develop --features pybindings
poetry run python pythondoc.py website/apidoc/python
mv website/apidoc/python/constriction/* website/apidoc/python/
rmdir website/apidoc/python/constriction
- name: Save artifact with website
uses: actions/upload-artifact@v2
with:
name: website
path: ./website
- name: Deploy website to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website
commit_message: Deploy