@@ -8,6 +8,8 @@ defaults:
8
8
run :
9
9
shell : bash
10
10
permissions : read-all
11
+ env :
12
+ NAME : mysql-to-sqlite3
11
13
12
14
jobs :
13
15
test :
@@ -19,10 +21,13 @@ jobs:
19
21
runs-on : ubuntu-latest
20
22
environment :
21
23
name : pypi
22
- url : https://pypi.org/p/mysql-to-sqlite3
24
+ url : https://pypi.org/p/${{ env.NAME }}
23
25
permissions :
24
26
id-token : write
25
27
contents : write
28
+ concurrency :
29
+ group : publish-${{ github.ref }}
30
+ cancel-in-progress : false
26
31
steps :
27
32
- uses : actions/checkout@v5
28
33
- name : Compare package version with ref/tag
32
37
VERSION=$(awk -F'"' '/__version__/ {print $2}' src/mysql_to_sqlite3/__init__.py)
33
38
TAG=${GITHUB_REF_NAME#v}
34
39
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)"
36
41
exit 1
37
42
fi
38
43
echo "VERSION=$VERSION" >> $GITHUB_ENV
@@ -49,32 +54,33 @@ jobs:
49
54
uses : actions/setup-python@v5
50
55
with :
51
56
python-version : " 3.x"
57
+ cache : " pip"
52
58
- name : Install build dependencies
53
59
id : install_build_dependencies
54
60
run : |
55
61
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
58
64
- name : Build a binary wheel and a source tarball
59
65
id : build
60
66
run : |
61
67
set -e
62
68
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
69
71
run : |
70
72
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
74
77
run : |
75
78
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
78
84
- name : Create tag-specific CHANGELOG
79
85
id : create_changelog
80
86
run : |
0 commit comments