Skip to content

Commit 311c395

Browse files
authored
AAE-37802 Enhance mock release cleanup (#276)
1 parent 8647ad1 commit 311c395

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

.github/workflows/mock-release-cleanup.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,41 @@ on:
1010
jobs:
1111
delete_version:
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
repo:
16+
- { name: "Activiti/activiti-cloud-full-chart", type: "release" }
17+
- { name: "Activiti/activiti-cloud", type: "release" }
18+
- { name: "Activiti/activiti-cloud-common-chart", type: "release" }
19+
- { name: "Activiti/Activiti", type: "release" }
20+
- { name: "Activiti/activiti-scripts", type: "tag" }
21+
fail-fast: false
1322
steps:
1423
- name: Delete version if the provided version ends with "-mock"
15-
id: delete_version
1624
shell: bash
1725
env:
1826
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
19-
REPO: ${{ inputs.repository }}
2027
VERSION: ${{ inputs.version }}
2128
run: |
22-
if [[ "${VERSION}" == *-mock ]]; then
23-
gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION}
24-
gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION}
25-
gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION}
26-
gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION}
27-
gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION}
28-
29-
else
30-
echo "version does not end with '-mock'."
29+
if [[ "${VERSION}" != *-mock ]]; then
3130
echo "Error: The provided version does not end with '-mock.'"
3231
exit 1
3332
fi
33+
34+
echo "Starting cleanup for version: ${VERSION} from ${{ matrix.repo.name }}"
35+
36+
if [[ "${{ matrix.repo.type }}" == "release" ]]; then
37+
if gh release delete -R ${{ matrix.repo.name }} -y --cleanup-tag ${VERSION}; then
38+
echo "✓ Deleted release from ${{ matrix.repo.name }}"
39+
else
40+
echo "❌ Failed to delete release from ${{ matrix.repo.name }}"
41+
exit 1
42+
fi
43+
else
44+
if gh api --silent -X DELETE /repos/${{ matrix.repo.name }}/git/refs/tags/${VERSION}; then
45+
echo "✓ Deleted tag from ${{ matrix.repo.name }}"
46+
else
47+
echo "❌ Failed to delete tag from ${{ matrix.repo.name }}"
48+
exit 1
49+
fi
50+
fi

0 commit comments

Comments
 (0)