From 47cfc72d8e4424b2aef10c460d07ef684fb09486 Mon Sep 17 00:00:00 2001 From: Koen Vossen Date: Tue, 13 Aug 2024 23:14:44 +0200 Subject: [PATCH 1/2] Add GH workflows for release --- .github/workflows/release.yml | 91 +++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..98897006 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +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 + + - name: Publish to PyPI + if: inputs.dry-run == false + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9bc7ef98..348ba05a 100644 --- a/.gitignore +++ b/.gitignore @@ -151,4 +151,7 @@ examples/pattern_matching/repository/*.json .* +!.github +!.gitignore + scratchpad From 1b4bd60d1bfecb0d09541a59ff43f5ed10fdcd21 Mon Sep 17 00:00:00 2001 From: Koen Vossen Date: Tue, 13 Aug 2024 23:23:19 +0200 Subject: [PATCH 2/2] minor --- .github/workflows/release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98897006..959a883d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,8 +84,9 @@ jobs: path: dist merge-multiple: true - - name: Publish to PyPI - if: inputs.dry-run == false - uses: pypa/gh-action-pypi-publish@release/v1 - with: - verbose: true \ No newline at end of file +# Skip for test +# - name: Publish to PyPI +# if: inputs.dry-run == false +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# verbose: true \ No newline at end of file