Skip to content
Latchkey

publish phonopy gh-pages workflow (phonopy/phonopy)

The publish phonopy gh-pages workflow from phonopy/phonopy, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: phonopy/phonopy.github/workflows/publish-gh-pages.ymlLicense BSD-3-ClauseView source

What it does

This is the publish phonopy gh-pages workflow from the phonopy/phonopy repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: publish phonopy gh-pages

on:
  push:
    branches: [publish-gh-pages]

jobs:
  docs:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash -l {0}
    strategy:
      matrix:
        python-version: ["3.13"]

    steps:
      - uses: actions/checkout@v4
      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test
          auto-activate-base: false
          miniforge-version: latest
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          conda activate test
          conda install --yes -c conda-forge python=${{ matrix.python-version }}
          conda install --yes -c conda-forge \
            matplotlib-base pyyaml scipy numpy spglib h5py pip cmake \
            c-compiler cxx-compiler maturin \
            sphinx-book-theme linkify-it-py myst-parser sphinxcontrib-bibtex sphinxcontrib-mermaid ipython
      - name: Setup symfc
        run: |
          conda activate test
          git clone https://github.com/symfc/symfc.git
          cd symfc
          pip install -e . -vvv
      - name: Build and install phonors
        run: |
          conda activate test
          git clone https://github.com/phonopy/phonors.git
          cd phonors
          maturin develop --release
      - name: Setup phonopy
        env:
          PHONOPY_NO_C_EXT: "1"
        run: |
          conda activate test
          pip install -e . -vvv
      - name: Build
        run: |
          conda activate test
          sphinx-build doc docs_build

      - name: Deploy docs to gh-pages
        if: ${{ github.ref == 'refs/heads/publish-gh-pages' }}
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs_build
          # deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: publish phonopy gh-pages
 
on:
  push:
    branches: [publish-gh-pages]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  docs:
    timeout-minutes: 30
    runs-on: latchkey-small
    defaults:
      run:
        shell: bash -l {0}
    strategy:
      matrix:
        python-version: ["3.13"]
 
    steps:
      - uses: actions/checkout@v4
      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: test
          auto-activate-base: false
          miniforge-version: latest
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          conda activate test
          conda install --yes -c conda-forge python=${{ matrix.python-version }}
          conda install --yes -c conda-forge \
            matplotlib-base pyyaml scipy numpy spglib h5py pip cmake \
            c-compiler cxx-compiler maturin \
            sphinx-book-theme linkify-it-py myst-parser sphinxcontrib-bibtex sphinxcontrib-mermaid ipython
      - name: Setup symfc
        run: |
          conda activate test
          git clone https://github.com/symfc/symfc.git
          cd symfc
          pip install -e . -vvv
      - name: Build and install phonors
        run: |
          conda activate test
          git clone https://github.com/phonopy/phonors.git
          cd phonors
          maturin develop --release
      - name: Setup phonopy
        env:
          PHONOPY_NO_C_EXT: "1"
        run: |
          conda activate test
          pip install -e . -vvv
      - name: Build
        run: |
          conda activate test
          sphinx-build doc docs_build
 
      - name: Deploy docs to gh-pages
        if: ${{ github.ref == 'refs/heads/publish-gh-pages' }}
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./docs_build
          # deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow