GitHub action to delete old tags from docker registry.
It will:
- Fetch all tags for specified image
- Extract semver versions from them. If extraction fails, tag will be ignored (so
latest
and other tags like it will be safe) - Sort extracted versions in descending order
- Deletes all tags below
keep-last
position in sorted list. This deletes manifests too, so if deleted tag points tolatest
manifest, these two tags will be deleted
Name | Description | Required | Default |
---|---|---|---|
registry |
Registry URL (with http/https) | ✔️ | |
username |
Username to login into registry | ✔️ | |
password |
Password to login into registry | ✔️ | |
repository |
Repository/image name to fetch tags from | ✔️ | |
keep-last |
How much versions to keep | 10 |
|
version-extractor |
Regex to extract SemVer version from tag | v?(\d+(.\d+)*) |
Keep 10 last versions of image
uses: alesharik/[email protected]
with:
registry: https://registry.url
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: test
Keep 5 last versions of image
uses: alesharik/[email protected]
with:
registry: https://registry.url
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: test
keep-last: 5
Keep 5 last versions of dev images
uses: alesharik/[email protected]
with:
registry: https://registry.url
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: test
keep-last: 5
version-extractor: 'v?(\d+(.\d+)*)-dev'