Bump ad-m/github-push-action from 0fafdd62b84042d49ec0cb92d9cac7f7ce4ec79e to d91a481090679876dfc4178fef17f286781251df #61
Workflow file for this run
This file contains 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: Docs | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['*'] | |
tags: ['*'] | |
pull_request: | |
branches: [main] | |
jobs: | |
build_docs: | |
runs-on: ubuntu-latest | |
env: | |
DOCS_PATH: ./docs/_build/html/ | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
channels: conda-forge | |
channel-priority: strict | |
environment-file: conda_environment.yml | |
activate-environment: hyperspy-bundle | |
- name: Conda info | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Update packages list | |
shell: bash -l {0} | |
run: | | |
python parse_list_libraries.py | |
echo "List of libraries and software" | |
echo "==============================" | |
cat ./docs/specs.rst | |
- name: Check links | |
shell: bash -l {0} | |
run: | | |
cd docs | |
make linkcheck | |
- name: Build docs | |
shell: bash -l {0} | |
run: | | |
cd docs | |
make html | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ env.DOCS_PATH }} | |
name: docs_html | |
push_docs: | |
needs: build_docs | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' && github.repository == 'hyperspy/hyperspy-bundle' }} | |
permissions: | |
# needs write permission to push the docs to gh-pages | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
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 |