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
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 viapublish-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
publish-dev.yml(after "Publish Prerelease") that:gh release list*-dev*tags that areprerelease: truegh release deleteGITHUB_TOKENwhich hascontents: writeon the repoworkflow_dispatchworkflow to manually trigger cleanup without a buildContext
gh release list --exclude-drafts --json tagName,createdAt,isPrereleasegh release delete <tag> --yes --cleanup-tag--cleanup-tagremoves the git tag alongside the releasepublish-dev.ymlalready hascontents: writepermissionLabels
enhancement,ci,release