chore(deps): lock file maintenance (#1984) #523
This file contains hidden or 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: Build Docs for the latest | |
| on: | |
| workflow_dispatch: # run on request (no need for PR) | |
| push: | |
| branches: | |
| - develop | |
| # No permissions by default | |
| permissions: {} | |
| jobs: | |
| Build-Docs: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Harden the runner (audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| enable-cache: false | |
| python-version: "3.10" | |
| version: "0.8.15" | |
| - name: Installing dependencies | |
| run: | | |
| sudo apt-get install pandoc graphviz | |
| uv lock --check | |
| uv sync --frozen --extra docs | |
| - name: Build-Docs | |
| run: | | |
| cd docs | |
| uv run make clean | |
| uv run make html | |
| - name: Create gh-pages branch | |
| run: | | |
| if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then | |
| echo RELEASE_VERSION="test_build" >> $GITHUB_ENV | |
| else | |
| echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV | |
| fi | |
| echo SOURCE_NAME=${GITHUB_REF#refs/*/} >> $GITHUB_ENV | |
| echo SOURCE_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT | |
| echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT | |
| existed_in_remote=$(git ls-remote --heads origin gh-pages) | |
| if [[ -z ${existed_in_remote} ]]; then | |
| echo "Creating gh-pages branch" | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git checkout --orphan gh-pages | |
| git reset --hard | |
| touch .nojekyll | |
| git add .nojekyll | |
| git commit -m "Initializing gh-pages branch" | |
| git push origin gh-pages | |
| git checkout "${GITHUB_REF#refs/*/}" | |
| echo "Created gh-pages branch" | |
| else | |
| echo "Branch gh-pages already exists" | |
| fi | |
| - name: Commit docs to gh-pages branch | |
| env: | |
| RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
| run: | | |
| git fetch | |
| git checkout gh-pages | |
| mkdir -p /tmp/docs_build | |
| cp -r docs/build/html/* /tmp/docs_build/ | |
| rm -rf "$RELEASE_VERSION"/* | |
| echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html | |
| mkdir -p "$RELEASE_VERSION" | |
| cp -r /tmp/docs_build/* ./"$RELEASE_VERSION" | |
| rm -rf /tmp/docs_build | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| if [[ "$RELEASE_VERSION" != 'test_build' ]]; then | |
| ln -sfn "$RELEASE_VERSION" latest | |
| fi | |
| git add ./index.html ./latest "$RELEASE_VERSION" | |
| git commit -m "Update documentation" -a || true | |
| - name: Push changes | |
| uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa # v1.0.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gh-pages |