Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions .github/workflows/polars-auto-release.yml

This file was deleted.

69 changes: 67 additions & 2 deletions .github/workflows/polars-release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,54 @@
name: Polars Release

on:
workflow_call:
push:
branches:
- main
paths:
- "polars/Cargo.toml"
workflow_dispatch:

permissions:
contents: read

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release_needed: ${{ steps.version.outputs.release_needed }}
release_tag: ${{ steps.version.outputs.release_tag }}
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Determine release version
id: version
env:
GH_TOKEN: ${{ github.token }}
run: |
release_tag="$(python - <<'PY'
import tomllib
from pathlib import Path

cargo = tomllib.loads(Path("polars/Cargo.toml").read_text())
print(f"polars-v{cargo['package']['version']}")
PY
)"

echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"

if gh release view "$release_tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "release_needed=false" >> "$GITHUB_OUTPUT"
else
echo "release_needed=true" >> "$GITHUB_OUTPUT"
fi

build-linux:
if: needs.prepare.outputs.release_needed == 'true'
needs: prepare
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -75,6 +116,8 @@ jobs:
path: polars/dist/*

build-macos:
if: needs.prepare.outputs.release_needed == 'true'
needs: prepare
runs-on: macos-14
defaults:
run:
Expand Down Expand Up @@ -120,6 +163,8 @@ jobs:
path: polars/dist/*

build-windows:
if: needs.prepare.outputs.release_needed == 'true'
needs: prepare
runs-on: windows-latest
defaults:
run:
Expand Down Expand Up @@ -162,6 +207,8 @@ jobs:
path: polars/dist/*

build-sdist:
if: needs.prepare.outputs.release_needed == 'true'
needs: prepare
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -188,7 +235,8 @@ jobs:
path: polars/dist/*

publish-pypi:
needs: [build-linux, build-macos, build-windows, build-sdist]
if: needs.prepare.outputs.release_needed == 'true'
needs: [prepare, build-linux, build-macos, build-windows, build-sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
Expand All @@ -202,3 +250,20 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
skip-existing: true

create-release:
if: needs.prepare.outputs.release_needed == 'true'
needs: [prepare, publish-pypi]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.release_tag }}
name: ${{ needs.prepare.outputs.release_tag }}
target_commitish: ${{ github.sha }}
generate_release_notes: true
draft: false
prerelease: false
6 changes: 3 additions & 3 deletions polars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ uv run python scripts/check_artifacts.py dist

1. Update the version in `Cargo.toml`.
2. Merge the version bump to `main`.
3. `Polars Auto Release` creates and publishes the matching `polars-vX.Y.Z` GitHub Release.
4. That release publishes the built artifacts to PyPI automatically.
3. `Polars Release` builds the artifacts and publishes them to PyPI.
4. After the PyPI publish succeeds, the workflow creates the matching `polars-vX.Y.Z` GitHub Release.

Any production GitHub Release tag must match the version in `Cargo.toml`.
If the matching GitHub Release already exists, the workflow exits without publishing a duplicate release.

Before the first release, configure a Trusted Publisher for PyPI on `alphaprime-dev/techr`.