Skip to content

Commit

Permalink
Merge pull request #348 from koenvo/feature/release-via-gh-actions
Browse files Browse the repository at this point in the history
Add GH workflows for release
  • Loading branch information
koenvo authored Aug 13, 2024
2 parents 016bd3a + 1b4bd60 commit f4606ee
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Release Python


# Most parts are borrowed from https://github.com/pola-rs/polars/blob/main/.github/workflows/release-python.yml


on:
workflow_dispatch:
inputs:
# Latest commit to include with the release. If omitted, use the latest commit on the main branch.
sha:
description: Commit SHA
type: string
# Create the sdist and build the wheels, but do not publish to PyPI / GitHub.
dry-run:
description: Dry run
type: boolean
default: false

defaults:
run:
shell: bash

jobs:
create-sdist:
runs-on: ubuntu-latest
python-version: 3.11

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- name: Create source distribution
run: python setup.py sdist

- name: Test sdist
run: |
pip install --force-reinstall --verbose dist/*.tar.gz
python -c 'import kloppy'
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist-kloppy
path: dist/*.tar.gz

build-wheel:
runs-on: ubuntu-latest
python-version: 3.11

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- name: Build wheel
run: python setup.py bdist_wheel

- name: Test wheel
run: |
pip install --force-reinstall --verbose dist/*.whl
python -c 'import kloppy'
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-kloppy
path: dist/*.whl

publish-to-pypi:
needs: [create-sdist, build-wheel]
environment:
name: release-python
url: https://pypi.org/project/kloppy
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Download sdists and wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

# Skip for test
# - name: Publish to PyPI
# if: inputs.dry-run == false
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# verbose: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,7 @@ examples/pattern_matching/repository/*.json

.*

!.github
!.gitignore

scratchpad

0 comments on commit f4606ee

Please sign in to comment.