Skip to content

Commit

Permalink
publish via pyproject.toml instead of setup.py for version details
Browse files Browse the repository at this point in the history
  • Loading branch information
duttonw committed Dec 10, 2024
1 parent df0debf commit bc23a20
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,40 @@ on:


jobs:

validateVersion:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Validate tag version
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
PYTHON_VERSION=$(grep -E '\bversion\s?=\s?"[^"]+"' pyproject.toml | awk -F '"' '{print $2}')
echo "Tag version is [${{ steps.version.outputs.version }}], Python version is [$PYTHON_VERSION]"
if [ "${{ steps.version.outputs.version }}" != "$PYTHON_VERSION" ]; then
echo "Version mismatch; tag version is [${{ steps.version.outputs.version }}] but Python version is [$PYTHON_VERSION]" >> $GITHUB_STEP_SUMMARY
exit 1
fi
lint:
needs: validateVersion
if: github.repository == 'ckan/ckanext-xloader'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install requirements
run: pip install flake8 pycodestyle

- name: Check syntax
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --extend-exclude ckan

Expand Down Expand Up @@ -148,16 +172,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

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

0 comments on commit bc23a20

Please sign in to comment.