This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
53 lines (46 loc) · 1.63 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: update-pip-constraints
description: Update PyPI constraints files for a specific version of Python
inputs:
python-version:
description: Python version to run update-pip-constraints with
required: true
runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Determine package configuration file
run: |
if [ -f pyproject.toml ]; then
if grep -q "\[project\]" pyproject.toml; then
echo 'SETUP_FILE=pyproject.toml' | tee -a $GITHUB_ENV
fi
elif [ -f setup.cfg ]; then
if grep -q "\[metadata\]" setup.cfg && grep -q "\[options\]" setup.cfg; then
echo 'SETUP_FILE=setup.cfg' | tee -a $GITHUB_ENV
fi
fi
shell: bash
- if: env.SETUP_FILE == 'setup.cfg'
run: |
pip install update-pip-constraints@git+https://github.com/ComPWA/update-pip-constraints@v1
shell: bash
- if: env.SETUP_FILE == 'pyproject.toml'
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --color=always --system update-pip-constraints@git+https://github.com/ComPWA/update-pip-constraints@v1
shell: bash
- run: update-pip-constraints
shell: bash
env:
FORCE_COLOR: "1"
TERM: ANSI
- name: Show git diff
run: git diff --color --unified=0
shell: bash
- uses: actions/upload-artifact@v4
with:
name: pip-constraints-${{ inputs.python-version }}
path: .constraints/py${{ inputs.python-version }}.txt