46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
# Generates requirements.lock from requirements.txt using Python 3.11 (same as build).
|
|
# Run manually (workflow_dispatch) or on changes to requirements.txt.
|
|
# After running, commit the generated requirements.lock so builds use it for fast installs.
|
|
|
|
name: Update requirements.lock
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- int
|
|
paths:
|
|
- 'requirements.txt'
|
|
|
|
jobs:
|
|
update-lock:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write # push requirements.lock
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install pip-tools
|
|
run: python -m pip install --upgrade pip pip-tools
|
|
|
|
- name: Generate requirements.lock
|
|
run: pip-compile requirements.txt -o requirements.lock
|
|
|
|
- name: Commit and push requirements.lock
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add requirements.lock
|
|
if git diff --staged --quiet; then
|
|
echo "No changes to requirements.lock"
|
|
else
|
|
git commit -m "chore: update requirements.lock"
|
|
git push
|
|
fi
|