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
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
environment: pypi
permissions:
id-token: write
contents: read
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
Expand All @@ -27,3 +27,6 @@ jobs:
with:
packages-dir: sdk/dist/
print-hash: true
- run: gh release create "${{ github.ref_name }}" --generate-notes sdk/dist/*.whl sdk/dist/*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
38 changes: 38 additions & 0 deletions scripts/backfill-releases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail

PYPI_PACKAGE="decree"
VERSIONS=("0.1.0" "0.2.0")

for version in "${VERSIONS[@]}"; do
tag="v${version}"
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT

echo "Fetching PyPI metadata for ${PYPI_PACKAGE} ${version}..."
metadata=$(curl -fsSL "https://pypi.org/pypi/${PYPI_PACKAGE}/${version}/json")

mapfile -t urls < <(echo "$metadata" | python3 -c "
import json, sys
data = json.load(sys.stdin)
for f in data['urls']:
if f['packagetype'] in ('bdist_wheel', 'sdist'):
print(f['url'])
")

for url in "${urls[@]}"; do
filename=$(basename "$url")
echo "Downloading ${filename}..."
curl -fsSL -o "${tmpdir}/${filename}" "$url"
done

echo "Creating GitHub release for ${tag}..."
gh release create "$tag" \
--repo opendecree/decree-python \
--generate-notes \
"${tmpdir}"/*.whl \
"${tmpdir}"/*.tar.gz

trap - EXIT
rm -rf "$tmpdir"
done