Skip to content

Commit

Permalink
Create release.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cwmeijer authored Feb 13, 2024
1 parent 8cf220c commit 6c12852
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and upload to PyPI

on:
workflow_dispatch:
release:
types:
- published

jobs:
build:
name: Build universal wheel and source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-python-and-package
with:
extras-require: publishing
- name: Build wheel and source distribution
run: python -m build
- uses: actions/upload-artifact@v4
with:
path: dist/*

upload_test_pypi:
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

upload_pypi:
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit 6c12852

Please sign in to comment.