Upgrade requirements #16
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python 3.10 and 3.12 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.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@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
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 |