Align Pages workflow #5
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: Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install documentation dependencies | |
| run: python -m pip install '.[docs,ase]' | |
| - name: Build documentation | |
| run: >- | |
| python -m sphinx -W -b html | |
| -d _build/doctrees | |
| docs _site/PQViewer | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build fixed-dataset viewer | |
| working-directory: frontend | |
| env: | |
| VITE_STATIC_DEMO: "true" | |
| VITE_BASE_PATH: /PQViewer/viewer/ | |
| PQVIEWER_OUT_DIR: ../_site/PQViewer/viewer | |
| run: npm run build | |
| - name: Pack the perovskite demo | |
| run: >- | |
| python scripts/build_static_demo.py | |
| examples/strontium-titanate.extxyz | |
| _site/PQViewer/viewer/demo | |
| - name: Configure deployment key | |
| env: | |
| DOCS_DEPLOY_KEY: ${{ secrets.DOCS_DEPLOY_KEY }} | |
| run: | | |
| if [ -z "$DOCS_DEPLOY_KEY" ]; then | |
| echo "::error::DOCS_DEPLOY_KEY is not configured" | |
| exit 1 | |
| fi | |
| install -m 700 -d ~/.ssh | |
| printf '%s\n' "$DOCS_DEPLOY_KEY" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| printf '%s\n' \ | |
| "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" \ | |
| > ~/.ssh/known_hosts | |
| - name: Publish generated site | |
| run: | | |
| git clone --branch gh-pages --single-branch \ | |
| git@github.com:MolarVerse/molarverse.github.io.git _pages | |
| rsync -a --delete _site/PQViewer/ _pages/PQViewer/ | |
| touch _pages/.nojekyll | |
| git -C _pages config user.name "github-actions[bot]" | |
| git -C _pages config user.email \ | |
| "41898282+github-actions[bot]@users.noreply.github.com" | |
| git -C _pages add -- .nojekyll PQViewer | |
| if ! git -C _pages diff --cached --quiet; then | |
| git -C _pages commit -m "Update PQViewer documentation" | |
| git -C _pages push origin gh-pages | |
| fi |