Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reusable workflow from hyperspy organisation for the doc workflow #13

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 9 additions & 89 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,17 @@
name: Docs
name: Documentation

on: [push, pull_request]

jobs:
build_docs:
# This build is to make PR comments for the sphinx warning and check if
# web links are not broken
name: Check links and make PR comments
runs-on: ubuntu-latest
env:
DOCS_PATH: ./doc/_build/html/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Build:
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/doc.yml@main

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'

- name: Install build docs
shell: bash -l {0}
run: |
pip install .'[doc]'

# Add sphinx warnings as PR comments
- uses: sphinx-doc/sphinx-problem-matcher@master

- name: Build docs
shell: bash -l {0}
run: |
cd doc
make SPHINXOPTS="-W --keep-going" html

- uses: actions/upload-artifact@v3
with:
path: ${{ env.DOCS_PATH }}
name: docs_html

- name: Check links
shell: bash -l {0}
run: |
cd doc
make linkcheck

push_docs:
# This build is to push changes to gh-pages branch (https://hyperspy.org/exspy)
needs: build_docs
name: Push to gh-pages
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' && github.repository == 'hyperspy/exspy' }}
Push:
needs: Build
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'hyperspy' }}
permissions:
# needs write permission to push the docs to gh-pages
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: gh-pages

- uses: actions/download-artifact@v3
with:
name: docs_html
path: .

- name: list files
run: |
ls

- name: Git status
run: |
git status
git status -s
if [[ $(git status -s) ]]; then
HAS_CHANGES='true'
else
HAS_CHANGES='false'
fi
echo "HAS_CHANGES=${HAS_CHANGES}" >> $GITHUB_ENV

- name: Commit files
# Skip when there is nothing to commit
if: ${{ env.HAS_CHANGES == 'true' }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "Update docs build" -a

- name: Push changes
if: ${{ env.HAS_CHANGES == 'true' }}
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/push_doc.yml@main
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ https://holospy.readthedocs.io/en/latest/changes.html
usable dataset is downloaded from `doi:10.5281/zenodo.7645765 <https://zenodo.org/record/6599071>`_
(`HyperSpy #3082 <https://github.com/hyperspy/hyperspy/issues/3082>`_)
- Add functionality to fit the :ref:`EELS fine structure <eels.fine_structure>` using components, e.g. :py:class:`hyperspy.api.model.components1D.Gaussian`. (`HyperSpy #3206 <https://github.com/hyperspy/hyperspy/issues/3206>`_)

- Use reusable workflow from the hyperspy organisation for the doc workflow (`#13 <https://github.com/hyperspy/exspy/pull/13>`_)

Initiation (2023-10-28)
=======================
Expand Down
Loading