v0.0.3 #3
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: PyPI Publish | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
publish: | |
name: Publish | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Poetry | |
if: steps.cache-poetry.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.python-poetry.org | python - | |
- name: Add Poetry to $PATH | |
run: | | |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
- name: Add version to environment vars | |
run: | | |
PROJECT_VERSION=$(poetry version --short) | |
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | |
- name: Check if tag version matches project version | |
run: | | |
TAG=$(git describe HEAD --tags --abbrev=0) | |
echo $TAG | |
echo $PROJECT_VERSION | |
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi | |
- name: Get Poetry version | |
run: poetry --version | |
- name: Check pyproject.toml validity | |
run: poetry check --no-interaction | |
- name: Install deps | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-interaction | |
- name: Publish to PyPI | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry publish --build |