From 15f070a554541f87fff17c4a7ed1c23c959ee303 Mon Sep 17 00:00:00 2001 From: Minki Kim Date: Thu, 16 Apr 2026 13:59:05 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20polars=20=EB=A6=B4?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=A8=EC=9D=BC=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PyPI Trusted Publishing 제약을 피할 수 있도록 릴리스 빌드와 배포, GitHub Release 생성을 하나의 top-level 워크플로로 정리한다. Made-with: Cursor --- .github/workflows/polars-auto-release.yml | 72 ----------------------- .github/workflows/polars-release.yml | 68 ++++++++++++++++++++- polars/README.md | 6 +- 3 files changed, 69 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/polars-auto-release.yml diff --git a/.github/workflows/polars-auto-release.yml b/.github/workflows/polars-auto-release.yml deleted file mode 100644 index 5bdc80d..0000000 --- a/.github/workflows/polars-auto-release.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Polars Auto Release - -on: - push: - branches: - - main - paths: - - "polars/Cargo.toml" - workflow_dispatch: - -jobs: - create-release: - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - release_created: ${{ steps.version.outputs.release_created }} - 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 - )" - - latest_tag="$(gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" --jq ' - map(select(.draft == false and .prerelease == false and (.tag_name | startswith("polars-v")))) - | .[0].tag_name // "" - ')" - - echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT" - - if [ "$release_tag" = "$latest_tag" ]; then - echo "release_created=false" >> "$GITHUB_OUTPUT" - else - echo "release_created=true" >> "$GITHUB_OUTPUT" - fi - - - name: Create published GitHub release - if: steps.version.outputs.release_created == 'true' - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ steps.version.outputs.release_tag }} - name: ${{ steps.version.outputs.release_tag }} - target_commitish: ${{ github.sha }} - generate_release_notes: true - draft: false - prerelease: false - - publish-pypi: - if: needs.create-release.outputs.release_created == 'true' - needs: create-release - permissions: - contents: read - id-token: write - # Releases created with the default GitHub token do not fan out into new - # workflow runs, so reuse the publish workflow directly here. - uses: ./.github/workflows/polars-release.yml - secrets: inherit diff --git a/.github/workflows/polars-release.yml b/.github/workflows/polars-release.yml index 2db1208..41f8f53 100644 --- a/.github/workflows/polars-release.yml +++ b/.github/workflows/polars-release.yml @@ -1,13 +1,53 @@ name: Polars Release on: - workflow_call: + push: + branches: + - main + paths: + - "polars/Cargo.toml" 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: @@ -75,6 +115,8 @@ jobs: path: polars/dist/* build-macos: + if: needs.prepare.outputs.release_needed == 'true' + needs: prepare runs-on: macos-14 defaults: run: @@ -120,6 +162,8 @@ jobs: path: polars/dist/* build-windows: + if: needs.prepare.outputs.release_needed == 'true' + needs: prepare runs-on: windows-latest defaults: run: @@ -162,6 +206,8 @@ jobs: path: polars/dist/* build-sdist: + if: needs.prepare.outputs.release_needed == 'true' + needs: prepare runs-on: ubuntu-latest defaults: run: @@ -188,7 +234,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: @@ -202,3 +249,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 diff --git a/polars/README.md b/polars/README.md index 533c7b7..fd4bdcd 100644 --- a/polars/README.md +++ b/polars/README.md @@ -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`. From 8dc3d329c00e2acf7e71c8863c4af30b87e3edd2 Mon Sep 17 00:00:00 2001 From: Minki Kim Date: Thu, 16 Apr 2026 14:07:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20polars=20=EB=A6=B4?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=20=EC=88=98=EB=8F=99=20=EC=8B=A4=ED=96=89=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 장애 복구나 재시도를 위해 단일 릴리스 워크플로를 workflow_dispatch로도 실행할 수 있게 한다. Made-with: Cursor --- .github/workflows/polars-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/polars-release.yml b/.github/workflows/polars-release.yml index 41f8f53..d775f5b 100644 --- a/.github/workflows/polars-release.yml +++ b/.github/workflows/polars-release.yml @@ -6,6 +6,7 @@ on: - main paths: - "polars/Cargo.toml" + workflow_dispatch: permissions: contents: read