Skip to content

Add GitHub Actions workflow to update Poetry lock #30

Add GitHub Actions workflow to update Poetry lock

Add GitHub Actions workflow to update Poetry lock #30

Workflow file for this run

# .github/workflows/sphinx-docs.yaml
name: sphinx-docs
on:
push:
branches: [main, develop]
tags: ['*']
workflow_dispatch:
permissions:
contents: write
jobs:
build-docs:
runs-on: ubuntu-latest
concurrency:
group: sphinx-${{ github.ref }}
cancel-in-progress: true
env:
BLOG_REPO: DiogoRibeiro7/DiogoRibeiro7.github.io
BLOG_DEST: packages/gensurvpy # adjust as needed
PYTHON_VERSION: '3.11'
steps:
- name: Checkout package repository
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies with Poetry
run: poetry install --with docs
- name: Build Sphinx documentation for GitHub Pages
run: poetry run sphinx-build -b html -c docs/gh_conf docs/source docs/build
- name: Checkout blog repository
uses: actions/checkout@v5
with:
repository: ${{ env.BLOG_REPO }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
path: blog-repo
- name: Copy documentation to blog (cleans removed files)
run: |
mkdir -p "blog-repo/${BLOG_DEST}"
rsync -av --delete docs/build/ "blog-repo/${BLOG_DEST}/"
- name: Commit and push changes to blog
run: |
cd blog-repo
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update gensurvpy Sphinx documentation"
git push
fi