-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# set -x | ||
set -e | ||
|
||
echo ::group:: Initialize various paths | ||
|
||
repo_dir=$GITHUB_WORKSPACE/$INPUT_REPOSITORY_PATH | ||
doc_dir=$repo_dir/$INPUT_DOCUMENTATION_PATH | ||
# https://stackoverflow.com/a/4774063/4799273 | ||
action_dir=$GITHUB_ACTION_PATH | ||
|
||
echo Action: $action_dir | ||
echo Workspace: $GITHUB_WORKSPACE | ||
echo Repository: $repo_dir | ||
echo Documentation: $doc_dir | ||
|
||
echo Adding ~/.local/bin to system path | ||
PATH=$HOME/.local/bin:$PATH | ||
if ! command -v sphinx-build &>/dev/null; then | ||
echo Sphinx is not successfully installed | ||
exit 1 | ||
else | ||
echo Everything goes well | ||
fi | ||
|
||
echo ::endgroup:: | ||
|
||
echo ::group:: Creating build directory | ||
build_dir=/tmp/sphinxnotes-pages | ||
mkdir -p $build_dir || true | ||
echo Temp directory \"$build_dir\" is created | ||
|
||
echo ::group:: Running Sphinx builder | ||
if ! sphinx-build -b html $INPUT_SPHINX_BUILD_OPTIONS "$doc_dir" "$build_dir"; then | ||
# See: https://github.com/sphinx-notes/pages/issues/28 | ||
# echo ::endgroup:: | ||
# echo ::group:: Dumping Sphinx error log | ||
# for l in $(ls /tmp/sphinx-err*); do | ||
# cat $l | ||
# done | ||
exit 1 | ||
fi | ||
echo ::endgroup:: | ||
|
||
echo "artifact=$build_dir" >> $GITHUB_OUTPUT |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Sphinx docs to gh-pages | ||
name: Docs | ||
|
||
on: | ||
push: | ||
|
@@ -10,11 +10,22 @@ on: | |
jobs: | ||
sphinx_docs_to_gh-pages: | ||
runs-on: ubuntu-22.04 | ||
name: Sphinx docs to gh-pages | ||
name: Docs | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
permissions: | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Skip workflow if only certain files have been changed. | ||
- name: Get changed files | ||
id: changed-files-specific | ||
|
@@ -26,8 +37,6 @@ jobs: | |
README.md | ||
CHANGELOG.md | ||
requirements.txt | ||
setup.py | ||
pyproject.toml | ||
- name: Setup packages | ||
if: steps.changed-files-specific.outputs.only_changed != 'true' | ||
|
@@ -40,12 +49,42 @@ jobs: | |
run: | | ||
pip install -e .[docs] | ||
- name: Running the Sphinx to gh-pages Action | ||
- name: Enable github problem matcher | ||
uses: sphinx-doc/github-problem-matcher@master | ||
|
||
- id: build | ||
name: Build documentation | ||
if: steps.changed-files-specific.outputs.only_changed != 'true' | ||
run: ./.github/actions/docs.sh | ||
shell: bash | ||
env: | ||
# See https://github.com/actions/runner/issues/665 | ||
INPUT_DOCUMENTATION_PATH: './docs/source' | ||
INPUT_SPHINX_BUILD_OPTIONS: '' | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
if: steps.changed-files-specific.outputs.only_changed != 'true' | ||
|
||
- name: Fix file permissions | ||
shell: sh | ||
if: runner.os == 'Linux' | ||
# https://github.com/actions/deploy-pages/issues/188 | ||
run: | | ||
chmod -c -R +rX "$INPUT_PATH" | | ||
while read line; do | ||
echo "::warning title=Invalid file permissions automatically fixed::$line" | ||
done | ||
env: | ||
INPUT_PATH: ${{ steps.build.outputs.artifact }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
if: steps.changed-files-specific.outputs.only_changed != 'true' | ||
uses: uibcdf/[email protected] | ||
with: | ||
branch: main | ||
dir_docs: docs | ||
sphinx-apidoc-opts: '--separate -o ./source/_include ../pyg_spectral' | ||
sphinx-apidoc-exclude: '../*setup* ../*.ipynb' | ||
sphinx-opts: '' | ||
path: ${{ steps.build.outputs.artifact }} | ||
|
||
- id: deployment | ||
name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v4 | ||
if: steps.changed-files-specific.outputs.only_changed != 'true' |
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