Maven Snapshots in Packages accumulate / is there a way to clean up old SNAPSHOTs #48971
Replies: 6 comments 3 replies
-
Yes, you are correct that currently there is no built-in way to automatically delete old snapshot versions in GitHub Packages. When you deploy a snapshot version to GitHub Packages, each build creates a new timestamped artifact, and there is no built-in functionality to automatically delete old artifacts. However, you can use GitHub Actions to delete old snapshot versions. You can write a custom script or use an existing action to delete old snapshot versions. Here is an example workflow that you can modify to delete old snapshot versions:
This workflow runs every day at midnight and deletes all but the latest 5 snapshot versions of a specific Maven package in a specific repository owned by your organization. You can customize the values for repository, package-name, package-version, and keep to fit your specific needs. Note that you need to have appropriate permissions to delete packages in the repository, and you also need to provide a valid GITHUB_TOKEN secret that has those permissions. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer, I'm aware that I can delete entire versions. See this ticket for example: actions/delete-package-versions#71 The problem is that this wastes a lot of disk space (that we'll eventually have to pay for), and the only option seems to be to delete the entire version, which is a bit too much. Btw. the workflow you posted uses an action that doesn't seem to be public. |
Beta Was this translation helpful? Give feedback.
-
We just started exploring the option to replace Nexus with GitHub Packages and this would basically make that nonviable . Unless you would agree that as long as there is no option to clean up these old versions we only have to pay for the storage of the latest version. This would explode very quickly for applications that are under active development especially since we might use versions like "-SNAPSHOT" or other snapshot versions that never change in some projects. Deleting the entire versions before you attempt to deploy it again seems like an ugly workaround as well. |
Beta Was this translation helpful? Give feedback.
-
<รายละเอียด><สรุป>รายละเอียด</สรุป>
</หน้า> |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
We are evaluating if we can migrate to GitHub packages as a maven repository for our organization.
One thing we noticed is that when we build maven -SNAPSHOT versions multiple times, the artifacts accumulate quickly under the -SNAPSHOT version (since maven appends a timestamp to each artifact, and we want to build each commit to our main branch).
The older artifacts are not needed anymore, but they still waste disk space.
Is there a way to say "keep only the latest x SNAPSHOT versions" like in other tools?
Or is there a way to clean up outdated artifacts with an action?
As far as I understand it, currently it's only possible to delete the entire version... is my understanding correct?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions