From c0425660eb16f02099e9f5ee5753bf257cd3686c Mon Sep 17 00:00:00 2001 From: Azalea Date: Wed, 4 Nov 2026 09:32:56 +0000 Subject: [PATCH] [F] Release - Pin hatchling<1.32.0 for PyPI metadata 2.4 and support immutable releases --- .github/workflows/release.yml | 59 +++++++++++++++++------------------ pyproject.toml | 2 +- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index beed8a6a..9f3c0036 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -266,53 +266,50 @@ jobs: --version "${{ needs.metadata.outputs.version }}" \ --output RELEASE_NOTES.md - - name: Create or update release metadata + - name: Create or update release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} TAG: ${{ needs.metadata.outputs.tag }} VERSION: ${{ needs.metadata.outputs.version }} run: | + extra_args=() + if [[ "$VERSION" == *-* ]]; then + extra_args+=(--prerelease) + fi + if gh release view "$TAG" >/dev/null 2>&1; then echo "GitHub Release $TAG already exists." gh release edit "$TAG" \ --title "$VERSION" \ - --notes-file RELEASE_NOTES.md - else - gh release create "$TAG" \ - --verify-tag \ - --title "$VERSION" \ - --notes-file RELEASE_NOTES.md - fi + --notes-file RELEASE_NOTES.md \ + "${extra_args[@]}" - - name: Upload missing release assets - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_REPO: ${{ github.repository }} - TAG: ${{ needs.metadata.outputs.tag }} - run: | - mapfile -t existing_assets < <(gh release view "$TAG" --json assets --jq '.assets[].name') - missing_assets=() - - for file in dist/*; do - name="$(basename "$file")" - found=false - for existing in "${existing_assets[@]}"; do - if [[ "$existing" == "$name" ]]; then - found=true - break + mapfile -t existing_assets < <(gh release view "$TAG" --json assets --jq '.assets[].name') + missing_assets=() + for file in dist/*; do + name="$(basename "$file")" + found=false + for existing in "${existing_assets[@]}"; do + if [[ "$existing" == "$name" ]]; then + found=true + break + fi + done + if [[ "$found" == "false" ]]; then + missing_assets+=("$file") fi done - if [[ "$found" == "false" ]]; then - missing_assets+=("$file") + if ((${#missing_assets[@]} > 0)); then + gh release upload "$TAG" "${missing_assets[@]}" fi - done - - if ((${#missing_assets[@]} == 0)); then - echo "All release assets are already uploaded." else - gh release upload "$TAG" "${missing_assets[@]}" + gh release create "$TAG" dist/* \ + --verify-tag \ + --title "$VERSION" \ + --notes-file RELEASE_NOTES.md \ + "${extra_args[@]}" fi publish-pypi: diff --git a/pyproject.toml b/pyproject.toml index ef8fc75f..0ca2ad32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling<1.32.0"] build-backend = "hatchling.build" [project]