Skip to content

v0.1.7

v0.1.7 #31

name: Upload to PyPi
on:
release:
types: [published]
# .github/workflows/ci-cd.yml
jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# retrieve your distributions here
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
pip install hatch
- name: Set package version from release tag
run: |
case "${GITHUB_REF_NAME}" in
v*) release_version="${GITHUB_REF_NAME#v}" ;;
*) echo "Expected a v-prefixed release tag, got ${GITHUB_REF_NAME}" >&2; exit 1 ;;
esac
hatch version --force "$release_version"
test "$(hatch version)" = "$release_version"
- name: Build and publish
run: |
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1