Cleanup Releases and packages #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup Releases and packages | |
on: workflow_dispatch | |
jobs: | |
Cleanup: | |
name: Delete old packages and releases | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get pom informations | |
id: pom-info | |
run: | | |
GROUP_ID=$( ./mvnw help:evaluate -Dexpression=project.groupId -q -DforceStdout ) | |
ARTIFACT_ID=$( ./mvnw help:evaluate -Dexpression=project.artifactId -q -DforceStdout ) | |
echo "::set-output name=group-id::$GROUP_ID" | |
echo "::set-output name=artifact-id::$ARTIFACT_ID" | |
- name: Display pom informations | |
run: | | |
echo "groupId: ${{ steps.pom-info.outputs.group-id }}" | |
echo "artifactId: ${{ steps.pom-info.outputs.artifact-id }}" | |
- name: Display packages names | |
run: echo "${{ steps.pom-info.outputs.group-id }}.${{ steps.pom-info.outputs.artifact-id }}" | |
- name: Clean old packages - keep last 2 | |
uses: actions/delete-package-versions@v5 | |
with: | |
min-versions-to-keep: 2 | |
package-name: | | |
"${{ steps.pom-info.outputs.group-id }}.${{ steps.pom-info.outputs.artifact-id }}" | |
- name: Clean old releases - keep last 2 | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 2 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |