From 94ca85705c5a28ebf2edf8975b0d780454f90a2d Mon Sep 17 00:00:00 2001 From: Juha Louhiranta Date: Mon, 4 Mar 2024 10:43:17 +0200 Subject: [PATCH] chore: add Github actions for PyPI release Refs: HP-2270 --- .github/workflows/release.yml | 27 +++++++++++++++++++++++++++ .github/workflows/staging.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/staging.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0907d91 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build-and-publish: + name: Build and publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install dependencies + run: pip install -U setuptools wheel build + - name: Build + run: python -m build . + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 0000000..9638803 --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,28 @@ +name: Publish to TestPyPI + +on: + push: + branches: [master] + +jobs: + build-and-publish: + name: Build and publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install dependencies + run: pip install -U setuptools wheel build + - name: Build + run: python -m build . + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + verbose: true