This action provides the following functionality for GitHub Actions users:
- Deleting old releases from a repository.
- Optionally removing the tags associated with the removed releases.
- Optionally keeping the latest patch of each older minor versions.
- Configuring how many releases to keep.
See action.yml
steps:
- uses: actions/checkout@v3
- uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 5
keep-old-minor-releases: true
keep-old-minor-releases-count: 1
Input | Required | Default | Description |
---|---|---|---|
token | Yes | Your Github token. Can be abtained by using ${{ secrets.GITHUB_TOKEN }} |
|
keep-count | No | 3 | Number of releases to keep. |
keep-old-minor-releases | Yes | true | Keep the latest release of each older minor versions. |
keep-old-minor-releases-by | No | 'minor' | Which semver level should we use to keep old release? Can be: 'major' , 'minor' , or 'patch' . |
keep-old-minor-releases-count | No | 1 | Number of old releases in each minor version to keep. |
include-prerelease | No | false | Always include prerelease versions. (node-semver) |
semver-loose | No | false | Interpret versions and ranges loosely. (node-semver) |
remove-tags | No | false | Also remove the tags associated with the removed releases. |
dry-run | No | false | Doesn't delete anything. Only a test run. |
Say you have the following versions in your release:
[
2.1.5, 2.1.4, 2.1.3, 2.1.2, 2.1.1, 2.1.0,
2.0.3, 2.0.2, 2.0.1, 2.0.0,
1.2.3, 1.2.2, 1.2.1, 1.2.0,
1.1.3, 1.1.2, 1.1.1, 1.1.0,
1.0.1, 1.0.0,
]
The following config will delete all but 2.1.5, 2.1.4
:
- uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 2
keep-old-minor-releases: false
The following config will delete all but 2.1.5, 2.1.4, 2.0.3, 1.2.3, 1.1.3, 1.0.1
:
- uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 2
keep-old-minor-releases: true
The following config will delete all but 2.1.5, 2.1.4, 2.0.3, 1.2.3
:
- uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 2
keep-old-minor-releases: true
keep-old-minor-releases-by: 'major'
The scripts and documentation in this project are released under the MIT License
Contributions are welcome!