Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep N versions of specified version pattern. #21

Open
andersson09 opened this issue Jan 2, 2022 · 2 comments
Open

Keep N versions of specified version pattern. #21

andersson09 opened this issue Jan 2, 2022 · 2 comments

Comments

@andersson09
Copy link

andersson09 commented Jan 2, 2022

Is it possible to keep N versions of the specified version pattern rather than any version.

Scenario:
I would like to delete both old release and pre-release packages. However, with the current set-up there is a possibility of losing either all release or all pre-release packages. This would mainly be used for private packages.

Thanks!

@rubengees
Copy link
Member

If you use a consistent versioning scheme for both types of packages, this should be possible. If you set the version-pattern option, only versions matching that will be considered for deletion.

Let's say your release versions look like "1.2.3" and your pre-release versions look like "1.2.3-alpha1".

Delete old release versions:

- name: Delete release versions
  uses: smartsquaregmbh/[email protected]
  with:
    version-pattern: "^\\d+\\.\\d+\\.\\d+$"
    names: |
      your-package

Delete old pre-release version:

- name: Delete RC versions
  uses: smartsquaregmbh/[email protected]
  with:
    version-pattern: "^\\d+\\.\\d+\\.\\d+-alpha\\d+$"
    names: |
      your-package

I recommend trying these with dry-run: true to see what would be deleted in the logs.

@andersson09
Copy link
Author

andersson09 commented Mar 9, 2022

I have a similar setup. The problem I have is that I want to keep the 3 latest pre-release and the 3 latest release, so 6 packages in total. Example:

I have 3 pre-release packages of A.
I have 3 release packages of A.
I run the 'Delete release versions' keep: 3

It will delete all 3 release versions since there are already 3 pre-release versions. The keep 3 is ignoring the version-pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants