diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml new file mode 100644 index 00000000..278f94bc --- /dev/null +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -0,0 +1,55 @@ +name: Mock release cleanup +description: Remove mock release and tag on a repository +inputs: + version: + description: Mock release version to be removed from tags and releases (should end with -mock) + required: true + repo: + description: Path the repository + required: true + gh-token: + description: 'GitHub Token' + required: true +runs: + using: composite + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + repository: ${{ inputs.repo }} + token: ${{ inputs.gh-token }} + + - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@34b2301fc6245fa98ed73a82e04d4f9ab4eb5a3f #v3.6.0 + id: check-tag + with: + tag: ${{ inputs.version }} + + - name: Delete tag if it exist and ends with "-mock" + if: steps.check-tag.outputs.exists == 'true' + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.gh-token }} + VERSION: ${{ inputs.version }} + run: | + if [[ "${VERSION}" == *-mock ]]; then + echo "Removing '${VERSION}' tag from: ${REPO}" + git push origin --delete ${VERSION} || true + else + echo "Error: The provided version does not end with '-mock.'" + exit 1 + fi + + - name: Delete release if the provided version ends with "-mock" + id: delete_version + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.gh-token }} + VERSION: ${{ inputs.version }} + REPO: ${{ inputs.repo }} + run: | + if [[ "${VERSION}" == *-mock ]]; then + echo "Removing '${VERSION}' release from: ${REPO}" + gh release delete -R ${REPO} -y ${VERSION} + else + echo "Error: The provided version does not end with '-mock.'" + exit 1 + fi diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 68e2bf5a..079f62b8 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -10,24 +10,19 @@ on: jobs: delete_version: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + repository: [ 'Activiti/activiti-cloud-full-chart', + 'Activiti/activiti-scripts', + 'Activiti/activiti-cloud', + 'Activiti/activiti-cloud-common-chart', + 'Activiti/activiti' ] steps: - - name: Delete version if the provided version ends with "-mock" - id: delete_version - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - REPO: ${{ inputs.repository }} - VERSION: ${{ inputs.version }} - run: | - if [[ "${VERSION}" == *-mock ]]; then - gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION} - gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} - gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION} - gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION} - gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION} - - else - echo "version does not end with '-mock'." - echo "Error: The provided version does not end with '-mock.'" - exit 1 - fi + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + - uses: ./.github/actions/remove-mock-release-and-tag + with: + version: ${{ inputs.version }} + repo: ${{ matrix.repository }} + gh-token: ${{ secrets.BOT_GITHUB_TOKEN }} + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 diff --git a/.github/workflows/run-release.yml b/.github/workflows/run-release.yml index ecb35774..34a13701 100644 --- a/.github/workflows/run-release.yml +++ b/.github/workflows/run-release.yml @@ -409,6 +409,7 @@ jobs: - activiti-cloud - activiti-cloud-common-chart - activiti-cloud-full-chart + - activiti-scripts env: VERSION: ${{ needs.load-release-info.outputs.version }} NOTES_START_TAG: ${{ needs.load-release-info.outputs.notes-start-tag }}