Bump bump-my-version from 0.21.0 to 0.21.1 #1755
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: Docs | |
"on": | |
workflow_call: | |
inputs: | |
dependency-graph-output: | |
description: 'Location in the repository of the dependency graph image.' | |
default: './docs/assets/dependencies.mmd' | |
required: false | |
type: string | |
push: | |
branches: | |
- main | |
concurrency: | |
# Group workflow jobs so new commits cancels in-progress execution triggered by previous commits. | |
# Source: https://mail.python.org/archives/list/pypa-committers@python.org/thread/PCBCQMJF64JGRBOX7E2EE4YLKHT4DI55/ | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
autofix-typo: | |
name: Fix typos | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: crate-ci/typos@v1.21.0 | |
with: | |
write_changes: true | |
- name: Remove local typos binary | |
run: rm ./typos | |
- uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
# We need custom PAT with workflows permissions to fix typos in .github/workflows/*.yaml` files. | |
token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }} | |
assignees: ${{ github.actor }} | |
commit-message: "[autofix] Typo" | |
title: "[autofix] Typo" | |
body: > | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
labels: "📚 documentation" | |
branch: autofix-typo | |
optimize-images: | |
name: Optimize images | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
# XXX Waiting for a recent release for image-actions so we'll get rid of some warning annotations like | |
# "Unexpected input(s) 'compressOnly'". See: https://github.com/calibreapp/image-actions/issues/128 | |
- uses: calibreapp/image-actions@1.1.0 | |
id: image_actions | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
compressOnly: true | |
- uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
assignees: ${{ github.actor }} | |
commit-message: "[autofix] Optimize images" | |
title: "[autofix] Optimize images" | |
body: > | |
${{ steps.image_actions.outputs.markdown }} | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
labels: "📚 documentation" | |
branch: optimize-images | |
check-mailmap: | |
name: Does .mailmap exist? | |
runs-on: ubuntu-22.04 | |
outputs: | |
exists: ${{ steps.detection.outputs.exists }} | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- id: detection | |
run: | | |
echo "exists=$( [[ -f './.mailmap' ]] && echo 'true' )" >> "$GITHUB_OUTPUT" | |
- name: Detection results | |
run: | | |
echo "Does .mailmap exist at root? ${{ steps.detection.outputs.exists && true || false }}" | |
update-mailmap: | |
name: Update .mailmap | |
needs: | |
- check-mailmap | |
# Only update mailmap if a file is found at the root of repository. | |
if: needs.check-mailmap.outputs.exists | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
with: | |
# Fetch all history to extract all contributors. | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
**/pyproject.toml | |
requirements/*.txt | |
- name: Generate .mailmap | |
run: > | |
python -c "$(curl -fsSL | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/.github/update_mailmap.py)" | |
- uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
assignees: ${{ github.actor }} | |
commit-message: "[autofix] Update .mailmap" | |
title: "[autofix] Update `.mailmap`" | |
body: > | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
labels: "📚 documentation" | |
branch: update-mailmap | |
project-metadata: | |
name: Project metadata | |
runs-on: ubuntu-22.04 | |
outputs: | |
is_poetry_project: ${{ steps.project-metadata.outputs.is_poetry_project }} | |
package_name: ${{ steps.project-metadata.outputs.package_name }} | |
is_sphinx: ${{ steps.project-metadata.outputs.is_sphinx }} | |
active_autodoc: ${{ steps.project-metadata.outputs.active_autodoc }} | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
with: | |
# Checkout pull request HEAD commit to ignore actions/checkout's merge commit. Fallback to push SHA. | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
# We're going to browse all new commits. | |
fetch-depth: 0 | |
- name: Hack setup-python cache | |
id: setup_python_hack | |
# XXX Create an empty pyproject.toml if this file (or any *requirements.txt) can't be found in repository. | |
# This hack fix an issue with setup-python, which ends up with this error in non-Python repos: | |
# | |
# Run actions/setup-python@v5.1.0 | |
# with: | |
# python-version: 3.12 | |
# cache: pip | |
# cache-dependency-path: | | |
# **/pyproject.toml | |
# requirements/*.txt | |
# Installed versions | |
# Successfully set up CPython (3.12.1) | |
# Error: No file in /home/runner/work/awesome-iam/awesome-iam matched to | |
# [requirements/*.txt or **/pyproject.toml], make sure you have checked out the target repository | |
# | |
# This has been reported at: https://github.com/actions/setup-python/issues/807 | |
# In the future this might be addressed by: https://github.com/actions/setup-python/pull/762 | |
# or https://github.com/actions/setup-python/issues/751 | |
if: hashFiles('requirements/*.txt', '**/pyproject.toml') == '' | |
run: | | |
touch ./pyproject.toml | |
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT" | |
- uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
**/pyproject.toml | |
requirements/*.txt | |
- name: Remove setup-python hack | |
if: steps.setup_python_hack.outputs.tmp_deps_file | |
run: | | |
rm ./pyproject.toml | |
- name: Install uv | |
run: | | |
python -m pip install uv | |
- name: Install Poetry from pinned requirements.txt | |
# uv needs a venv. See: https://github.com/astral-sh/uv/issues/1374 | |
run: | | |
uv venv --system | |
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/metadata.txt | |
- name: Project metadata | |
id: project-metadata | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: > | |
source .venv/bin/activate && python -c "$(curl -fsSL | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/.github/metadata.py)" | |
update-deps-graph: | |
name: Update dependency graph | |
needs: | |
- project-metadata | |
if: fromJSON(needs.project-metadata.outputs.is_poetry_project) | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
**/pyproject.toml | |
requirements/*.txt | |
- name: Install pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install pipdeptree and Poetry on system | |
run: > | |
python -m pip install --requirement | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/pipdeptree.txt | |
--requirement | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt | |
- name: Install project with Poetry | |
run: | | |
poetry install --only main --no-interaction | |
# XXX We explicitly provide the Python binary from the virtualenv so pipdeptree will restrict its dependency tree | |
# to virtualenv. See: https://github.com/tox-dev/pipdeptree/issues/130#issuecomment-2029280908 | |
- name: Run pipdeptree for debug | |
run: > | |
pipdeptree --python "$( poetry env info --executable )" | |
${{ needs.project-metadata.outputs.package_name | |
&& format('--packages {0}', needs.project-metadata.outputs.package_name)}} | |
- name: Create dir structure | |
run: | | |
mkdir -p "$(dirname "${{ inputs.dependency-graph-output }}")" | |
# TODO: generate a graph for each extra requirement sets (like main, dev, docs, tests, ...). | |
# See: https://github.com/tox-dev/pipdeptree/issues/107 | |
- name: Generate graph | |
run: > | |
pipdeptree --python "$( poetry env info --executable )" | |
${{ needs.project-metadata.outputs.package_name | |
&& format('--packages {0}', needs.project-metadata.outputs.package_name)}} | |
--mermaid > ${{ inputs.dependency-graph-output }} | |
- uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
assignees: ${{ github.actor }} | |
commit-message: "[autofix] Regenerate dependency graph" | |
title: "[autofix] Regenerate dependency graph" | |
body: > | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
labels: "📚 documentation" | |
branch: update-deps-graph | |
update-autodoc: | |
name: Update autodoc | |
needs: | |
- project-metadata | |
if: > | |
fromJSON(needs.project-metadata.outputs.is_poetry_project) | |
&& fromJSON(needs.project-metadata.outputs.active_autodoc) | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
**/pyproject.toml | |
requirements/*.txt | |
- name: Install pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install Poetry | |
run: > | |
python -m pip install --requirement | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt | |
- name: Install project dependencies | |
run: | | |
poetry install --no-interaction | |
- name: Run Sphinx | |
run: | | |
poetry run sphinx-apidoc --no-toc --module-first --force -o ./docs . | |
- uses: peter-evans/create-pull-request@v6.0.5 | |
with: | |
assignees: ${{ github.actor }} | |
commit-message: "[autofix] Update Sphinx autodoc" | |
title: "[autofix] Update Sphinx autodoc" | |
body: > | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
labels: "📚 documentation" | |
branch: update-autodoc | |
deploy-docs: | |
name: Deploy Sphinx doc | |
needs: | |
- project-metadata | |
if: fromJSON(needs.project-metadata.outputs.is_poetry_project) && fromJSON(needs.project-metadata.outputs.is_sphinx) | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
**/pyproject.toml | |
requirements/*.txt | |
- name: Install pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install Poetry | |
run: > | |
python -m pip install --requirement | |
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt | |
- name: Install project dependencies | |
# Let sphinx-click access project's code to generate CLI help. | |
run: | | |
poetry config virtualenvs.create false | |
poetry install --no-interaction | |
- name: Install Graphviz | |
# So we can use the sphinx.ext.graphviz plugin. | |
# See: https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html | |
run: | | |
sudo apt update | |
sudo apt install --yes graphviz | |
- name: Build documentation | |
run: | | |
poetry run sphinx-build -b html ./docs ./docs/html | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4.0.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/html | |
force_orphan: true | |
awesome-template-sync: | |
name: Sync awesome template | |
if: > | |
startsWith(github.event.repository.name, 'awesome-') | |
&& github.event.repository.name != 'awesome-template' | |
runs-on: ubuntu-22.04 | |
# We need custom PAT through the whole job so we get workflow permissions to update all the boilerplate .github | |
# files from awesome-template. | |
steps: | |
- name: Initial checkout | |
uses: actions/checkout@v4.1.6 | |
with: | |
token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Sync from template repo | |
id: template_sync | |
uses: AndreasAugustin/actions-template-sync@v2.1.0 | |
with: | |
github_token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }} | |
source_repo_path: kdeldycke/awesome-template | |
# Action will update PR only if there is file changes. is_force_push_pr also force the PR to be updated | |
# only if metadata changes. | |
is_force_push_pr: true | |
is_allow_hooks: true | |
# Replace "/kdeldycke/awesome-template/" in URLs by "/kdeldycke/awesome-<repo_id>/". | |
hooks: > | |
precommit: | |
commands: | |
- find ./.github/ -type f -iregex ".*\.\(md\|yaml\)$" -print -exec sed -i | |
"s/\/kdeldycke\/awesome-template\//\/kdeldycke\/${{ github.event.repository.name }}\//g" "{}" \; | |
pr_title: "[sync] Updates from `awesome-template`" | |
pr_commit_msg: "[sync] Updates from awesome-template" | |
pr_branch_name_prefix: "sync-awesome-template" | |
pr_body: > | |
Files synced from [`${SOURCE_REPO_PATH}@${TEMPLATE_GIT_HASH}` | |
repository](${SOURCE_REPO}/tree/${TEMPLATE_GIT_HASH}). | |
<details><summary><code>Workflow metadata</code></summary> | |
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{ | |
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url | |
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow. | |
</details> | |
pr_labels: "📚 documentation" |