Skip to content

Generate Docs

Generate Docs #31

Workflow file for this run

# name: Generate Docs
# on:
# push:
# branches: [ stable ]
# workflow_dispatch:
# jobs:
# docs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python 3.9
# uses: actions/setup-python@v5
# with:
# python-version: 3.9
# - name: Build
# run: |
# sudo apt-get install pandoc
# python -m pip install --upgrade pip
# pip install -e .[dev]
# make docs
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{secrets.GITHUB_TOKEN}}
# publish_dir: docs/_build/html
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
candidate:
description: 'If true, this creates a release candidate.'
required: true
type: boolean
default: true
test_pypi:
description: 'If true, this will push to the test pypi instead of regular.'
type: boolean
default: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.candidate && 'main-clone' || 'stable' }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Create wheel
run: |
make dist
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ inputs.test_pypi && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }}
repository-url: ${{ inputs.test_pypi && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
- name: Bump to next candidate
if: ${{ inputs.candidate && !inputs.test_pypi }}
run: |
make bumpversion-candidate
- name: Get last commit message
if: ${{ inputs.candidate && !inputs.test_pypi }}
id: get_message
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "commit_message<<EOF" >> $GITHUB_ENV
echo "$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create PR for candidate
if: ${{ inputs.candidate && !inputs.test_pypi }}
id: bump-candidate-pr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
commit-message: ${{ env.commit_message }}
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
title: ${{ env.commit_message }}
body: "This is an auto-generated PR to bump the version to the next release candidate."
branch: bump-release-candidate
branch-suffix: short-commit-hash
base: main
- name: Enable Pull Request Automerge
if: steps.bump-candidate-pr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
pull-request-number: ${{ steps.bump-candidate-pr.outputs.pull-request-number }}
merge-method: squash