Skip to content

update template (#676) #1141

update template (#676)

update template (#676) #1141

Workflow file for this run

name: docs-build-deploy
on:
workflow_dispatch:
push:
branches: ["main", "docs-*"]
pull_request:
branches: ["*"]
release:
types: [published]
jobs:
build-docs:
runs-on: ubuntu-latest
permissions: write-all
env:
BLENDER_VERSION: blender-4.2.0-linux-x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.7"
cache: pip
- uses: quarto-dev/quarto-actions/setup@v2
- name: Set derived environment variables
run: |
echo "BLENDER_FILENAME=${{ env.BLENDER_VERSION }}.tar.xz" >> $GITHUB_ENV
echo "BLENDER_URL=https://mirrors.iu13.net/blender/release/Blender4.2/${{ env.BLENDER_VERSION }}.tar.xz" >> $GITHUB_ENV
- name: Install Blender Dependencies
run: |
sudo apt-get install libxxf86vm-dev -y
sudo apt-get install libxfixes3 -y
sudo apt-get install libxi-dev -y
sudo apt-get install libxkbcommon-x11-0 -y
sudo apt-get install libgl1-mesa-glx -y
- name: Download & Extract Blender
run: |
wget -q $BLENDER_URL
tar -xf $BLENDER_FILENAME
rm -rf $BLENDER_FILENAME
- name: Add Blender executable to path
run: |
echo "${{ github.workspace }}/${{ env.BLENDER_VERSION }}/" >> $GITHUB_PATH
- name: Build docs using blender
run: |
blender -b --python tests/python.py -- -m pip install .
blender -b --python docs/generate.py
- name: Build Docs
run: quarto render docs
# push to netlify -------------------------------------------------------
# set release name ----
- name: Configure pull release name
if: ${{github.event_name == 'pull_request'}}
run: |
echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV
env:
PR_NUMBER: ${{ github.event.number }}
- name: Configure branch release name
if: ${{github.event_name != 'pull_request'}}
run: |
# use branch name, but replace slashes. E.g. feat/a -> feat-a
echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
# deploy ----
- name: Create Github Deployment
uses: bobheadxi/[email protected]
if: github.event.pull_request.head.repo.full_name == github.repository
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ env.RELEASE_NAME }}
ref: ${{ github.head_ref }}
transient: true
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Netlify docs preview
if: github.event.pull_request.head.repo.full_name == github.repository
run: |
npm install -g netlify-cli
# push main branch to production, others to preview --
if [ "${ALIAS}" == "main" ]; then
netlify deploy --dir=docs/_build --alias="main"
else
netlify deploy --dir=docs/_build --alias="${ALIAS}"
fi
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
ALIAS: ${{ steps.deployment.outputs.env }}
- name: Update Github Deployment
if: github.event.pull_request.head.repo.full_name == github.repository
uses: bobheadxi/[email protected]
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: 'https://${{ steps.deployment.outputs.env }}--molecularnodes.netlify.app'
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Deploy Release Documentation
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'release'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build