test publish #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI.org | |
on: | |
push: | |
tags: ["v*"] | |
jobs: | |
pypi: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build python package | |
run: | | |
python3 -m pip install --upgrade build | |
python3 -m build | |
- name: Check package version | |
env: | |
EXPECTED_VERSION: ${{ github.ref_name }} | |
run: | | |
VERSION=$(grep -e "version\s*=\s*" -m 1 pyproject.toml | awk -F '"' '{print $2}') | |
if [ -z "$VERSION" ]; then | |
echo "Version not found" | |
exit 1 | |
fi | |
if [ "v$VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "Version $VERSION matches the tag name $EXPECTED_VERSION ." | |
exit 1 | |
fi | |
# - name: Publish package to PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# password: ${{ secrets.PYPI_TOKEN }} |