From 8e817039a2d55ba5de7a14f851c5b88d85ca787c Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Wed, 6 Mar 2024 07:16:08 -0800 Subject: [PATCH] adding pypi release to github actions on tag --- .github/workflows/python-app.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 098a87f..573423c 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -6,9 +6,12 @@ name: EMAnnotationSchemas on: push: branches: master + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: branches: master + jobs: test: name: Test against different Python versions @@ -60,3 +63,26 @@ jobs: - name: Test with pytest run: | pytest + + publish: + if: startsWith(github.ref, 'refs/tags/v') + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + - name: Build and publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: dist + verify_metadata: true + env: + # Ensure dependencies are installed and your package is built + PRE_BUILD_COMMANDS: >- + pip install build && + python -m build \ No newline at end of file