Skip to content

v2024.7.4 🌈

v2024.7.4 🌈 #2122

Workflow file for this run

name: docs
on:
push:
branches:
- "2024"
paths:
- "src/**"
- "docs/source/**"
- "examples/**"
- ".github/workflows/docs.yml"
pull_request:
branches:
- "2024"
paths:
- "src/**"
- "docs/source/**"
- "examples/**"
- ".github/workflows/docs.yml"
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REPO_NAME: ${{ github.event.repository.name }}
jobs:
branch:
runs-on: ubuntu-latest
steps:
- name: Get the version
id: branch
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "branch=${{ github.event.release.target_commitish }}" >> $GITHUB_OUTPUT
echo "publish=${{ github.event.release.target_commitish }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "pull_request" ]; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
echo "publish=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "push" ]; then
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "publish=latest" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "publish=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
outputs:
branch: ${{ steps.branch.outputs.branch }}
publish: ${{ steps.branch.outputs.publish }}
sphinx:
needs: branch
runs-on: ubuntu-latest
strategy:
matrix:
language: ["en", "zh_CN"]
builder: ["html"]
env:
LANGUAGE: ${{ matrix.language }}
VERSION: ${{ needs.branch.outputs.branch }}
PUBLISH: ${{ needs.branch.outputs.publish }}
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Installing the library
run: |
pip install .[docs]
pip install git+https://github.com/haiiliin/sphinx-immaterial.git
pip show abqpy
- name: Build the documentation
run: |
cd docs && make ${{ matrix.builder }}
env:
SPHINXOPTS: -j auto
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs-${{ matrix.language }}-${{ env.VERSION }}
path: docs/build/${{ matrix.builder }}
retention-days: 1
upload:
if: github.event_name != 'pull_request'
needs: [branch, sphinx]
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
language: ["en", "zh_CN"]
builder: ["html"]
env:
LANGUAGE: ${{ matrix.language }}
VERSION: ${{ needs.branch.outputs.branch }}
PUBLISH: ${{ needs.branch.outputs.publish }}
steps:
- uses: ahmadnassri/action-workflow-queue@v1
with:
timeout: 1200000
delay: 60000
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs-${{ matrix.language }}-${{ env.VERSION }}
path: docs/build/${{ matrix.builder }}/${{ matrix.language }}
- name: Upload the documentation
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/${{ matrix.builder }}/${{ matrix.language }}
destination_dir: ${{ matrix.language }}/${{ env.PUBLISH }}
keep_files: true