@@ -8,6 +8,8 @@ defaults:
88 run :
99 shell : bash
1010permissions : read-all
11+ env :
12+ NAME : mysql-to-sqlite3
1113
1214jobs :
1315 test :
@@ -19,10 +21,13 @@ jobs:
1921 runs-on : ubuntu-latest
2022 environment :
2123 name : pypi
22- url : https://pypi.org/p/mysql-to-sqlite3
24+ url : https://pypi.org/p/${{ env.NAME }}
2325 permissions :
2426 id-token : write
2527 contents : write
28+ concurrency :
29+ group : publish-${{ github.ref }}
30+ cancel-in-progress : false
2631 steps :
2732 - uses : actions/checkout@v5
2833 - name : Compare package version with ref/tag
3237 VERSION=$(awk -F'"' '/__version__/ {print $2}' src/mysql_to_sqlite3/__init__.py)
3338 TAG=${GITHUB_REF_NAME#v}
3439 if [[ "$VERSION" != "$TAG" ]]; then
35- echo "Version in src/mysql_to_sqlite3/__version__ .py ($VERSION) does not match tag ($TAG)"
40+ echo "Version in src/mysql_to_sqlite3/__init__ .py ($VERSION) does not match tag ($TAG)"
3641 exit 1
3742 fi
3843 echo "VERSION=$VERSION" >> $GITHUB_ENV
@@ -49,32 +54,33 @@ jobs:
4954 uses : actions/setup-python@v5
5055 with :
5156 python-version : " 3.x"
57+ cache : " pip"
5258 - name : Install build dependencies
5359 id : install_build_dependencies
5460 run : |
5561 set -e
56- python3 -m pip install --upgrade pip
57- pip install build setuptools wheel
62+ python3 -m pip install -U pip
63+ python3 -m pip install -U build
5864 - name : Build a binary wheel and a source tarball
5965 id : build
6066 run : |
6167 set -e
6268 python3 -m build --sdist --wheel --outdir dist/ .
63- - name : Publish distribution package to PyPI
64- id : publish
65- if : startsWith(github.ref, 'refs/tags')
66- uses : pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
67- - name : Install pyproject-parser
68- id : install_pyproject_parser
69+ - name : Verify package metadata (twine)
70+ id : twine_check
6971 run : |
7072 set -e
71- pip install pyproject-parser[cli]
72- - name : Read project name from pyproject.toml
73- id : read_project_name
73+ python3 -m pip install -U twine
74+ twine check dist/*
75+ - name : Ensure py.typed is packaged
76+ id : assert_py_typed
7477 run : |
7578 set -e
76- NAME=$(pyproject-parser info project.name -r | tr -d '"')
77- echo "NAME=$NAME" >> $GITHUB_ENV
79+ unzip -l dist/*.whl | grep -q 'mysql_to_sqlite3/py.typed'
80+ - name : Publish distribution package to PyPI
81+ id : publish
82+ if : startsWith(github.ref, 'refs/tags')
83+ uses : pypa/gh-action-pypi-publish@release/v1
7884 - name : Create tag-specific CHANGELOG
7985 id : create_changelog
8086 run : |
0 commit comments