diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml new file mode 100644 index 0000000..b082ce0 --- /dev/null +++ b/.github/workflows/publish_pypi.yml @@ -0,0 +1,50 @@ +name: Build and publish on PyPI + +on: + release: + types: [published] + tags: ["v*.*.*"] + workflow_dispatch: + +jobs: + build: + name: Build package + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out ${{ github.ref_name }} + uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install build + run: | + python -m pip install build + - name: Run build + run: python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish_pypi: + name: Publish on PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/fast-forward-indexes/ + permissions: + id-token: write + steps: + - name: Download the distribution packages + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1