File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,32 @@ if $DO_UPLOAD; then
7676
7777 echo " ---- Uploading to PyPI ----"
7878 python3 -m twine upload dist/*
79+
80+ # Update conda recipe meta.yaml with the new version and sha256
81+ PKG_VERSION=$( grep " ^version" pyproject.toml | awk -F' "' ' {print $2}' )
82+ TARBALL_URL=" https://pypi.org/packages/source/p/$PYPI_PACKAGE /$PYPI_PACKAGE -$PKG_VERSION .tar.gz"
83+
84+ echo " ---- Updating conda recipe to $PKG_VERSION ----"
85+ # Wait briefly for PyPI to make the tarball available
86+ for i in $( seq 1 30) ; do
87+ HTTP_CODE=$( curl -sL -o /dev/null -w " %{http_code}" " $TARBALL_URL " )
88+ if [[ " $HTTP_CODE " == " 200" ]]; then
89+ break
90+ fi
91+ echo " Waiting for PyPI tarball to become available... ($i /30)"
92+ sleep 5
93+ done
94+ if [[ " $HTTP_CODE " != " 200" ]]; then
95+ echo " Warning: could not fetch tarball from PyPI. Update meta.yaml manually." >&2
96+ else
97+ NEW_SHA=$( curl -sL " $TARBALL_URL " | sha256sum | awk ' {print $1}' )
98+ sed -i.bak " s|^ version:.*| version: \" $PKG_VERSION \" |" " $RECIPE_DIR /meta.yaml"
99+ sed -i.bak " s|^ url:.*| url: $TARBALL_URL |" " $RECIPE_DIR /meta.yaml"
100+ sed -i.bak " s|^ sha256:.*| sha256: $NEW_SHA |" " $RECIPE_DIR /meta.yaml"
101+ sed -i.bak " s|^ # sha256:.*| sha256: $NEW_SHA |" " $RECIPE_DIR /meta.yaml"
102+ rm -f " $RECIPE_DIR /meta.yaml.bak"
103+ echo " ✓ Updated meta.yaml: version=$PKG_VERSION sha256=$NEW_SHA "
104+ fi
79105fi
80106
81107# ── Conda ───────────────────────────────────────────────────────────────────
You can’t perform that action at this time.
0 commit comments