Skip to content

Cleanup Releases and packages #3

Cleanup Releases and packages

Cleanup Releases and packages #3

Workflow file for this run

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 }}"
package-type: "maven"
- 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 }}