try poetry-based build/publish workflow #1
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: CI Workflows | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Stuff Goes Here In The Future | |
run: echo "black, isort, flake8, mypy still to come..." | |
build_and_publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [lint] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Extract Version from Tag | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Install Dependencies | |
run: poetry install | |
- name: Update project.toml Version | |
run: poetry version $VERSION | |
- name: Build and Publish | |
run: poetry publish --build | |
# Authentication at PyPI is handled by "Trusted Publishers" feature, | |
# so no need to use the token. | |
# env: | |
# POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} |