Upgrade requirements #14
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
# This CI job is adapted from: | |
# build-and-inspect-python-package (2024-03-25), MIT license | |
# Ref: https://github.com/hynek/build-and-inspect-python-package/blob/v2.2.1/.github/workflows/update-dependencies.yml | |
name: Upgrade requirements | |
on: | |
schedule: | |
# run once a month at midnight of the first day of the month | |
- cron: 0 0 1 * * | |
workflow_dispatch: # run manually from actions tab | |
# Set permissions at the job level. | |
permissions: {} | |
jobs: | |
upgrade: | |
permissions: | |
contents: write # for peter-evans/create-pull-request to create branch | |
pull-requests: write # for peter-evans/create-pull-request to create a PR | |
name: Upgrade requirements | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Python 3.10 and 3.12 | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: | | |
3.10 | |
3.12 | |
cache: pip | |
- run: | | |
python3.10 --version | |
python3.12 --version | |
- name: Install pre-requisites (e.g. hatch) | |
run: python -m pip install --require-hashes --requirement=requirements/ci | |
- name: Upgrade ci requirements (using Python 3.10 for compatibility) | |
run: | | |
rm requirements/ci | |
HATCH_PYTHON=3.10 hatch env run --env ci -- python --version | |
- name: Upgrade docs requirements (using Python 3.12) | |
run: | | |
rm requirements/docs | |
HATCH_PYTHON=3.12 hatch env run --env docs -- python --version | |
# Ref: https://github.com/peter-evans/create-pull-request | |
- uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: requirement-upgrades | |
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
title: 'build(deps-dev): upgrade ci and docs requirements' | |
commit-message: 'build(deps-dev): upgrade ci and docs requirements' | |
body: | | |
Monthly scheduled CI and docs requirements upgrade (`hatch-pip-compile --upgrade --all`). | |
``` | |
hatch env run --env ci -- python --version | |
hatch env run --env docs -- python --version | |
``` | |
> [!NOTE] | |
> Mark this PR as "ready for review" to trigger additional checks. | |
add-paths: | | |
requirements/ci | |
requirements/docs | |
labels: | | |
type: build | |
deps: python | |
delete-branch: true | |
draft: true |