test: run of workflow #1
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: Deploy Sphinx documentation | |
on: | |
push: | |
branches: | |
- feat/sphinx | |
pull_request: | |
branches: | |
- feat/sphinx | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Install Sphinx onto runner with pip | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- run: pip install -U sphinx | |
# Step 2: Check if certain needed Sphinx files exist, if not we create defaults | |
- name: Sphinx exist and make | |
if: ${{ hashFiles('docs/conf.py') == '' && hashFiles('docs/index.rst') == '' && hashFiles('docs/Makefile') == '' && hashFiles('docs/make.bat') == ''}} | |
run: | | |
git clone ${{ github.server_url }}/${{ github.repository }}.git --branch feat/sphinx --single-branch feat/sphinx | |
git clone [email protected]:vortexntnu/vortex-ci.git --branch sphinx/docs-template --single-branch sphinx/docs-template | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add . | |
git commit -m "Update: Created template files for Sphinx" -a || true | |
# Step 3: Push changes runner has made to repository | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: feat/sphinx | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
build-deploy: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
# Step 4. Install dependencies and generate documentation | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Install dependencies | |
run: | | |
pip install sphinx sphinx_rtd_theme myst_parser | |
- name: Sphinx build | |
run: | | |
sphinx-build docs _build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/auto' }} | |
with: | |
publish_branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _build/ | |
force_orphan: true |