Merge pull request #65 from guzman-raphael/docs #4
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: Docs | |
on: | |
- push | |
jobs: | |
diagram: | |
if: github.repository_owner == 'walkerlab' && github.event.pusher.name != 'walkerlab-repo-writer[bot]' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install graphviz -y | |
cargo install cargo-modules | |
- uses: actions/create-github-app-token@v1 | |
id: generate_app_token | |
with: | |
app-id: ${{ secrets.WALKERLAB_REPO_WRITER_APP_ID }} | |
private-key: ${{ secrets.WALKERLAB_REPO_WRITER_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_app_token.outputs.token }} | |
- name: Generate crate diagram | |
run: | | |
mkdir -p docs | |
cargo modules dependencies \ | |
--no-uses --no-fns \ | |
--focus-on "orcapod::model::{Pod}" \ | |
--layout dot | dot -T svg > docs/crate_diagram.svg | |
- name: Sync GitHub | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add docs/crate_diagram.svg | |
git commit -m "Update crate diagram." || echo "Diagram unchanged, skipping commit." | |
git push | |
api: | |
if: github.repository_owner == 'walkerlab' && github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate API docs | |
run: | | |
cargo doc --no-deps | |
echo "<meta http-equiv=refresh content=0;url=orcapod/index.html>" > target/doc/index.html | |
- name: Upload | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: target/doc | |
- name: Deploy | |
id: deployment | |
uses: actions/deploy-pages@v4 |