Skip to content

Commit 9ff57b2

Browse files
committed
🦺 compare package version with ref/tag before publishing to PyPI
1 parent d5d93c7 commit 9ff57b2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ jobs:
1919
id-token: write
2020
steps:
2121
- uses: actions/checkout@v3
22+
- name: Compare package version with ref/tag
23+
id: compare
24+
run: |
25+
set -e
26+
VERSION=$(awk -F'"' '/__version__/ {print $2}' sqlite3_to_mysql/__version__.py)
27+
TAG=${GITHUB_REF_NAME#v}
28+
if [[ "$VERSION" != "$TAG" ]]; then
29+
echo "Version in sqlite3_to_mysql/__version__.py ($VERSION) does not match tag ($TAG)"
30+
exit 1
31+
fi
2232
- name: Set up Python
2333
uses: actions/setup-python@v4
2434
with:
@@ -30,13 +40,10 @@ jobs:
3040
- name: Build a binary wheel and a source tarball
3141
run: |
3242
python3 setup.py sdist bdist_wheel
33-
- name: Publish distribution 📦 to Test PyPI
43+
- name: Publish distribution package to Test PyPI
3444
uses: pypa/gh-action-pypi-publish@release/v1
3545
with:
36-
verbose: true
3746
repository-url: https://test.pypi.org/legacy/
38-
- name: Publish distribution 📦 to PyPI
47+
- name: Publish distribution package to PyPI
3948
if: startsWith(github.ref, 'refs/tags')
4049
uses: pypa/gh-action-pypi-publish@release/v1
41-
with:
42-
verbose: true

0 commit comments

Comments
 (0)