Skip to content

Publish

Publish #4

Workflow file for this run

name: Publish
on:
workflow_dispatch:
release:
types:
- published
jobs:
build:
name: "Build distribution"
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
# make sure tags are fetched so we can get a version
- name: Fetch Tags
run: |
git fetch --prune --unshallow --tags
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Build
run: pip install build
- name: Build Package
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: "Publish distribution"
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
runs-on: ubuntu-latest
needs: build
environment:
name: pypi
url: https://pypi.org/p/tesseract-core
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1