From 007e1ac03db752218bc8ed5fa6512b82a00221ad Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 7 Jul 2023 00:30:37 +0200 Subject: [PATCH] CI: Fix staging releases through GitHub Actions The GHA recipe did not manage to publish a release to PyPI. Because everything works on the `crate` driver package, let's just use the same recipe here without further ado. --- .github/workflows/main.yml | 25 ------------------------- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 214bb5ff..847244de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,28 +48,3 @@ jobs: - name: Lint & test run: ./devtools/ci.sh - - pypi: - name: Build & publish package to pypi - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - - name: Build package - run: | - python -m pip install twine wheel - python setup.py sdist bdist_wheel - twine check dist/*.tar.gz - - - name: Publish package to PyPI - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..3d2cb32c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +--- +name: release + +on: push + +jobs: + pypi: + name: Build & publish package to PyPI + runs-on: ubuntu-latest + if: startsWith(github.event.ref, 'refs/tags') + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + cache-dependency-path: 'setup.py' + + - name: Build package + run: | + python -m pip install build twine wheel + python -m build + twine check dist/{*.tar.gz,*.whl} + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}