-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (35 loc) · 1.38 KB
/
cleanup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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@v2
- 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: smartsquaregmbh/[email protected]
with:
keep: 2
names: |
"${{ 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 }}