Skip to content

Merge pull request #25 from robotont/humble-devel #5

Merge pull request #25 from robotont/humble-devel

Merge pull request #25 from robotont/humble-devel #5

Workflow file for this run

name: Build Docs
on:
push:
branches:
- '*'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set OUTPUT_FOLDER based on branch name
id: branch_name
run: |
BRANCH_NAME=$(echo $GITHUB_REF | awk 'BEGIN {FS="/"} {print $3}')
echo "BRANCH_NAME=$(echo $BRANCH_NAME)" >> $GITHUB_ENV
if [ "$BRANCH_NAME" = "main" ]; then
OUTPUT_FOLDER="docs/_build"
echo "Detected main branch, setting output folder to ${OUTPUT_FOLDER}"
else
OUTPUT_FOLDER="docs/_build/${BRANCH_NAME}"
echo "Detected non-main branch, setting output folder to ${OUTPUT_FOLDER}"
fi
echo "OUTPUT_FOLDER=${OUTPUT_FOLDER}" >> $GITHUB_ENV
# echo "::set-output name=OUTPUT_FOLDER::${OUTPUT_FOLDER}" # Set output for deploy job
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8 # Change this to your desired Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Documentation
run: |
sphinx-build -b html source "${OUTPUT_FOLDER}"
touch "${OUTPUT_FOLDER}/.nojekyll"
# echo "::set-output name=docs_folder::${OUTPUT_FOLDER}" # Set output for deploy job
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ${{ env.OUTPUT_FOLDER}}
deploy:
environment:
name: github-pages
url: ${{ steps.build.outputs.url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy for the main branch
id: deploy_main
if: github.ref == 'refs/heads/main'
run: echo "Deploy for the main branch ${{ env.BRANCH_NAME }}"
- name: Deploy for non-main branches
id: deploy_non_main
if: github.ref != 'refs/heads/main'
run: echo "Deploy for non-main branches ${{ env.BRANCH_NAME }}"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages