Skip to content

Backfill Manifests

Backfill Manifests #4

name: Backfill Manifests
on:
workflow_dispatch:
inputs:
limit:
description: "Number of releases to process (Max 250 due to GHA matrix limits)"
required: false
default: "30"
type: string
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-all-tags:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch release tags
id: set-matrix
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LIMIT: ${{ inputs.limit }}
run: |
# Safety Check: Matrix strategy has a hard limit of 256 jobs
if [ "$LIMIT" -gt 250 ]; then
echo "::warning::Limit $LIMIT exceeds GitHub Matrix safety. Capping at 250."
LIMIT=250
fi
echo "Fetching last $LIMIT releases..."
TAGS=$(gh release list \
--limit "$LIMIT" \
--exclude-drafts \
--exclude-pre-releases \
--json tagName \
--jq '[.[] | .tagName]')
if [ -z "$TAGS" ] || [ "$TAGS" == "[]" ]; then
echo "::error::No release tags found!"
exit 1
fi
echo "Found tags count: $(echo $TAGS | jq '. | length')"
echo "matrix=$TAGS" >> $GITHUB_OUTPUT
generate-manifests:
needs: get-all-tags
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10 # Slightly higher parallelization is fine for reads
matrix:
tag: ${{ fromJson(needs.get-all-tags.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "poetry"
- name: Install dependencies
run: |
pip install poetry
poetry install --no-interaction --no-ansi
- name: Fetch Assets Data
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "::group::Fetch Assets via GitHub CLI"
# Write JSON directly to file to bypass shell ARG_MAX limits
gh release view "${{ matrix.tag }}" --json assets --jq '.assets' > assets.json
if [ ! -s assets.json ]; then
echo "::error::Assets file is empty for tag ${{ matrix.tag }}"
exit 1
fi
echo "::endgroup::"
- name: Generate Manifest
env:
OWNER: ${{ github.repository_owner }}
run: |
echo "::group::Run Generation Script"
REPO_NAME="${{ github.repository }}" && REPO_NAME="${REPO_NAME##*/}"
# We use --assets-file now instead of --assets
poetry run python .github/scripts/generate_partial_manifest.py \
--tag "${{ matrix.tag }}" \
--owner "${{ github.repository_owner }}" \
--repo "${REPO_NAME}" \
--assets-file "assets.json" \
> manifest-part-${{ matrix.tag }}.json
cat manifest-part-${{ matrix.tag }}.json
echo "::endgroup::"
- name: Upload Manifest Artifact
uses: actions/upload-artifact@v4
with:
name: manifest-part-${{ matrix.tag }}
path: manifest-part-${{ matrix.tag }}.json
retention-days: 1