@@ -42,10 +42,11 @@ jobs:
4242 echo "Downloading release assets for ${REPO} tag ${TAG}"
4343 mkdir -p release_assets
4444 # Fetch release metadata for the tag
45- release_json=$(curl -sSf -H "Authorization: Bearer ${GITHUB_TOKEN}" "https://api.github.com/repos/${REPO}/releases/tags/${TAG}")
46- if [ -z "${release_json}" ]; then
47- echo "No release metadata found for tag ${TAG}" >&2
48- exit 1
45+ release_json=$(curl -sS -H "Authorization: Bearer ${GITHUB_TOKEN}" "https://api.github.com/repos/${REPO}/releases/tags/${TAG}" || true)
46+ if [ -z "${release_json}" ] || [ "${release_json}" = "null" ]; then
47+ echo "No release metadata found for tag ${TAG}; nothing to download. Skipping publish."
48+ mkdir -p release_assets
49+ exit 0
4950 fi
5051 # Iterate assets and download each one using the assets API (requires Accept header)
5152 echo "$release_json" | jq -r '.assets[] | [.id, .name] | @tsv' | while IFS=$'\t' read -r id name; do
@@ -58,11 +59,24 @@ jobs:
5859 run : |
5960 echo "Assets in release_assets:"
6061 ls -la release_assets || true
62+ - name : Check for wheel assets
63+ id : assets_check
64+ run : |
65+ set -euo pipefail
66+ mkdir -p release_assets
67+ count=0
68+ # Count wheel files (if any). Use glob safely.
69+ shopt -s nullglob || true
70+ files=(release_assets/*.whl)
71+ count=${#files[@]}
72+ echo "Found $count .whl files in release_assets"
73+ echo "asset_count=$count" >> $GITHUB_OUTPUT
6174 - name : Show package name and version (diagnostic)
6275 run : |
6376 python -c "import importlib,importlib.util,sys,pathlib; spec=importlib.util.find_spec('tomllib') or importlib.util.find_spec('tomli'); name=spec.name if spec else sys.exit(print('No TOML parser available (tomllib/tomli), skipping')); toml=importlib.import_module(name); p=pathlib.Path('pyalp/pyproject.toml'); (sys.exit(print('pyalp/pyproject.toml not found at', p)) if not p.exists() else None); data=toml.loads(p.read_text()); proj=data.get('project',{}); print('project.name =', proj.get('name')); print('project.version =', proj.get('version'))"
6477
6578 - name : Publish to PyPI (alp-graphblas)
79+ if : ${{ steps.assets_check.outputs.asset_count != '0' }}
6680 uses : pypa/gh-action-pypi-publish@release/v1
6781 with :
6882 packages-dir : release_assets/
0 commit comments