Typer CLI #21
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
# CI/CD workflow for the project. | |
name: cicd | |
on: | |
push: | |
jobs: | |
# Check for linting errors. | |
lint: | |
uses: ./.github/workflows/python-make-target.yaml | |
with: | |
target: lint | |
# Run the test suite. | |
test: | |
uses: ./.github/workflows/python-make-target.yaml | |
with: | |
target: test | |
# When a release is created on github (using the vX.Y.Z tag formatting), publish the package to PyPI. | |
publish: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-22.04 | |
needs: | |
- lint | |
- test | |
permissions: | |
id-token: write | |
env: | |
POETRY_VERSION: "1.8.2" | |
PYTHON_VERSION: "3.11" | |
steps: | |
- name: get code | |
uses: actions/checkout@v4 | |
# `poetry` is installed in ~/.local, so we cache it to speed up the action. Without the cache, it usually takes | |
# 15-20 seconds to install poetry. With the cache, it takes 1-3 seconds. | |
- name: cache poetry cli | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
# Invalidate the cache when this workflow file changes. | |
key: poetry-${{ runner.os }}-${{ env.POETRY_VERSION }}-${{ env.PYTHON_VERSION }} | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: build | |
run: poetry build | |
- name: publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |