Skip to content

Commit

Permalink
CI: Fix staging releases through GitHub Actions
Browse files Browse the repository at this point in the history
The GHA recipe did not manage to publish a release to PyPI. Because
everything works on the `crate` driver package, let's use the same
recipe here.
  • Loading branch information
amotl committed Jul 6, 2023
1 parent 4c082e7 commit 7ba0299
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 7ba0299

Please sign in to comment.