Skip to content

Auto-prune old dev prereleases #18

Description

@ricardoleal

Problem

Every dev tag push (e.g. v1.0.1-dev.1, v1.0.1-dev.2, etc.) creates a new prerelease on GitHub Releases via publish-dev.yml. Over time, these accumulate indefinitely. After dozens of dev iterations, the releases page becomes cluttered with stale dev builds that are no longer useful.

There is no automated cleanup mechanism.

Desired Outcome

Old dev prereleases (e.g. older than 30 days, or only keep the latest N = 5) are automatically deleted to keep the releases list focused on current builds.

Requirements

  • Add a cleanup step at the end of publish-dev.yml (after "Publish Prerelease") that:
    • Lists all releases with gh release list
    • Filters to only *-dev* tags that are prerelease: true
    • Sorts by creation date (newest first)
    • Keeps the latest N (configurable, suggest 10)
    • Deletes the rest with gh release delete
  • Use GITHUB_TOKEN which has contents: write on the repo
  • Optionally add a separate workflow_dispatch workflow to manually trigger cleanup without a build

Context

  • gh release list --exclude-drafts --json tagName,createdAt,isPrerelease
  • Delete command: gh release delete <tag> --yes --cleanup-tag
  • --cleanup-tag removes the git tag alongside the release
  • publish-dev.yml already has contents: write permission

Labels

enhancement, ci, release

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI / build / release automationenhancementNew feature or requestreleaseRelease pipeline / packaging / distribution

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions