Skip to content

Commit bc23a20

Browse files
committed
publish via pyproject.toml instead of setup.py for version details
1 parent df0debf commit bc23a20

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,40 @@ on:
3131

3232

3333
jobs:
34+
35+
validateVersion:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: '3.10'
43+
44+
- name: Validate tag version
45+
if: ${{ startsWith(github.ref, 'refs/tags') }}
46+
run: |
47+
PYTHON_VERSION=$(grep -E '\bversion\s?=\s?"[^"]+"' pyproject.toml | awk -F '"' '{print $2}')
48+
echo "Tag version is [${{ steps.version.outputs.version }}], Python version is [$PYTHON_VERSION]"
49+
if [ "${{ steps.version.outputs.version }}" != "$PYTHON_VERSION" ]; then
50+
echo "Version mismatch; tag version is [${{ steps.version.outputs.version }}] but Python version is [$PYTHON_VERSION]" >> $GITHUB_STEP_SUMMARY
51+
exit 1
52+
fi
53+
3454
lint:
55+
needs: validateVersion
3556
if: github.repository == 'ckan/ckanext-xloader'
3657
runs-on: ubuntu-latest
3758
steps:
3859
- uses: actions/checkout@v4
60+
3961
- uses: actions/setup-python@v5
4062
with:
4163
python-version: '3.10'
64+
4265
- name: Install requirements
4366
run: pip install flake8 pycodestyle
67+
4468
- name: Check syntax
4569
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --extend-exclude ckan
4670

@@ -148,16 +172,6 @@ jobs:
148172
- name: Checkout repository
149173
uses: actions/checkout@v4
150174

151-
- name: Validate tag version
152-
if: ${{ startsWith(github.ref, 'refs/tags') }}
153-
run: |
154-
PYTHON_VERSION=$(grep -E "\bversion='[^']+'" setup.py | awk -F "'" '{print $2}')
155-
echo "Tag version is [${{ steps.version.outputs.version }}], Python version is [$PYTHON_VERSION]"
156-
if [ "${{ steps.version.outputs.version }}" != "$PYTHON_VERSION" ]; then
157-
echo "Version mismatch; tag version is [${{ steps.version.outputs.version }}] but Python version is [$PYTHON_VERSION]" >> $GITHUB_STEP_SUMMARY
158-
exit 1
159-
fi
160-
161175
- name: Build package ${{ steps.version.outputs.reponame }} @ ${{ steps.version.outputs.version }}
162176
run: |
163177
pip install build

0 commit comments

Comments
 (0)