From 182782a8f493475ba1500c246751889fb696629a Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 12:21:41 +0100 Subject: [PATCH 01/27] workflow logs --- .github/workflows/mock-release-cleanup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 68e2bf5a..40a0d4d0 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -21,10 +21,15 @@ jobs: run: | if [[ "${VERSION}" == *-mock ]]; then gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION} + echo "Activiti/activiti-cloud-full-chart cleaned" gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} + echo "Activiti/activiti-scripts cleaned" gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION} + echo "Activiti/activiti-cloud cleaned" gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION} + echo "Activiti/activiti-cloud-common-chart cleaned" gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION} + echo "Activiti/activiti cleaned" else echo "version does not end with '-mock'." From c32ec10bfeedd959bc6d439b762ec328e320c8b0 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 12:23:35 +0100 Subject: [PATCH 02/27] disabling activiti-cloud-full-chart --- .github/workflows/mock-release-cleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 40a0d4d0..63dc7831 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -20,7 +20,7 @@ jobs: 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-cloud-full-chart -y --cleanup-tag ${VERSION} echo "Activiti/activiti-cloud-full-chart cleaned" gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} echo "Activiti/activiti-scripts cleaned" From d2df342747439e7461d78a2af3128ee647a2e9bb Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 12:30:56 +0100 Subject: [PATCH 03/27] enabling activiti-cloud-full-chart --- .github/workflows/mock-release-cleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 63dc7831..40a0d4d0 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -20,7 +20,7 @@ jobs: 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-cloud-full-chart -y --cleanup-tag ${VERSION} echo "Activiti/activiti-cloud-full-chart cleaned" gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} echo "Activiti/activiti-scripts cleaned" From f6daf57653d14b4594c7d2f11a9c671d6385478e Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 13:01:04 +0100 Subject: [PATCH 04/27] different log message+catching problems with removal --- .github/workflows/mock-release-cleanup.yml | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 40a0d4d0..b2bb0b3a 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -20,16 +20,20 @@ jobs: VERSION: ${{ inputs.version }} run: | if [[ "${VERSION}" == *-mock ]]; then - gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION} - echo "Activiti/activiti-cloud-full-chart cleaned" - gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} - echo "Activiti/activiti-scripts cleaned" - gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION} - echo "Activiti/activiti-cloud cleaned" - gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION} - echo "Activiti/activiti-cloud-common-chart cleaned" - gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION} - echo "Activiti/activiti cleaned" + echo "Removing releases and tags from: Activiti/activiti-cloud-full-chart" + gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION} || true + + echo "Removing releases and tags from: Activiti/activiti-scripts" + gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} || true + + echo "Removing releases and tags from: Activiti/activiti-cloud" + gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION} || true + + echo "Removing releases and tags from: Activiti/activiti-cloud-common-chart" + gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION} || true + + echo "Removing releases and tags from: Activiti/activiti" + gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION} || true else echo "version does not end with '-mock'." From f7f1302a0f3da001e65eecdd6a9f5eba36f9f36e Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 13:48:22 +0100 Subject: [PATCH 05/27] different log message+catching problems with removal --- .github/workflows/mock-release-cleanup.yml | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index b2bb0b3a..4dc73e84 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -20,20 +20,35 @@ jobs: VERSION: ${{ inputs.version }} run: | if [[ "${VERSION}" == *-mock ]]; then - echo "Removing releases and tags from: Activiti/activiti-cloud-full-chart" - gh release delete -R Activiti/activiti-cloud-full-chart -y --cleanup-tag ${VERSION} || true + echo "Removing release from: Activiti/activiti-cloud-full-chart" + gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true + echo "Removing tag from: Activiti/activiti-cloud-full-chart" + gh repo clone Activiti/activiti-cloud-full-chart --depth 1 + git push origin --delete ${VERSION} || true - echo "Removing releases and tags from: Activiti/activiti-scripts" - gh release delete -R Activiti/activiti-scripts -y --cleanup-tag ${VERSION} || true + echo "Removing release from: Activiti/activiti-scripts" + gh release delete -R Activiti/activiti-scripts -y ${VERSION} || true + echo "Removing tag from: Activiti/activiti-scripts" + gh repo clone Activiti/activiti-scripts --depth 1 + git push origin --delete ${VERSION} || true - echo "Removing releases and tags from: Activiti/activiti-cloud" - gh release delete -R Activiti/activiti-cloud -y --cleanup-tag ${VERSION} || true + echo "Removing release from: Activiti/activiti-cloud" + gh release delete -R Activiti/activiti-cloud -y ${VERSION} || true + echo "Removing tag from: Activiti/activiti-cloud" + gh repo clone Activiti/activiti-cloud --depth 1 + git push origin --delete ${VERSION} || true - echo "Removing releases and tags from: Activiti/activiti-cloud-common-chart" - gh release delete -R Activiti/activiti-cloud-common-chart -y --cleanup-tag ${VERSION} || true + echo "Removing release from: Activiti/activiti-cloud-common-chart" + gh release delete -R Activiti/activiti-cloud-common-chart -y ${VERSION} || true + echo "Removing tag from: Activiti/activiti-cloud-common-chart" + gh repo clone Activiti/activiti-cloud-common-chart --depth 1 + git push origin --delete ${VERSION} || true - echo "Removing releases and tags from: Activiti/activiti" - gh release delete -R Activiti/Activiti -y --cleanup-tag ${VERSION} || true + echo "Removing release from: Activiti/activiti" + gh release delete -R Activiti/Activiti -y ${VERSION} || true + echo "Removing tag from: Activiti/activiti" + gh repo clone Activiti/activiti --depth 1 + git push origin --delete ${VERSION} || true else echo "version does not end with '-mock'." From 9786b7496a044423097ac03accf345c02f2a71cc Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 13:53:48 +0100 Subject: [PATCH 06/27] no depth --- .github/workflows/mock-release-cleanup.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 4dc73e84..557417fd 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -23,31 +23,31 @@ jobs: echo "Removing release from: Activiti/activiti-cloud-full-chart" gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-full-chart" - gh repo clone Activiti/activiti-cloud-full-chart --depth 1 + gh repo clone Activiti/activiti-cloud-full-chart git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-scripts" gh release delete -R Activiti/activiti-scripts -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-scripts" - gh repo clone Activiti/activiti-scripts --depth 1 + gh repo clone Activiti/activiti-scripts git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-cloud" gh release delete -R Activiti/activiti-cloud -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud" - gh repo clone Activiti/activiti-cloud --depth 1 + gh repo clone Activiti/activiti-cloud git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-cloud-common-chart" gh release delete -R Activiti/activiti-cloud-common-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-common-chart" - gh repo clone Activiti/activiti-cloud-common-chart --depth 1 + gh repo clone Activiti/activiti-cloud-common-chart git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti" gh release delete -R Activiti/Activiti -y ${VERSION} || true echo "Removing tag from: Activiti/activiti" - gh repo clone Activiti/activiti --depth 1 + gh repo clone Activiti/activiti git push origin --delete ${VERSION} || true else From a4f129d02fe016c5af62002002c4c0663109da24 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:00:06 +0100 Subject: [PATCH 07/27] cd --- .github/workflows/mock-release-cleanup.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 557417fd..e5eebb83 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -23,31 +23,31 @@ jobs: echo "Removing release from: Activiti/activiti-cloud-full-chart" gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-full-chart" - gh repo clone Activiti/activiti-cloud-full-chart + gh repo clone Activiti/activiti-cloud-full-chart && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-scripts" gh release delete -R Activiti/activiti-scripts -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-scripts" - gh repo clone Activiti/activiti-scripts + gh repo clone Activiti/activiti-scripts && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-cloud" gh release delete -R Activiti/activiti-cloud -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud" - gh repo clone Activiti/activiti-cloud + gh repo clone Activiti/activiti-cloud && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti-cloud-common-chart" gh release delete -R Activiti/activiti-cloud-common-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-common-chart" - gh repo clone Activiti/activiti-cloud-common-chart + gh repo clone Activiti/activiti-cloud-common-chart && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true echo "Removing release from: Activiti/activiti" gh release delete -R Activiti/Activiti -y ${VERSION} || true echo "Removing tag from: Activiti/activiti" - gh repo clone Activiti/activiti + gh repo clone Activiti/activiti && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true else From d586366baf7741f799c2a75f319db3e40f1a959f Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:05:37 +0100 Subject: [PATCH 08/27] bot added --- .github/workflows/mock-release-cleanup.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index e5eebb83..d6544321 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -20,6 +20,9 @@ jobs: VERSION: ${{ inputs.version }} run: | if [[ "${VERSION}" == *-mock ]]; then + git config --global user.email "${{ secrets.BOT_GITHUB_USERNAME}}@no-reply.users.github.com" + git config --global user.name "${{ secrets.BOT_GITHUB_USERNAME}}" + echo "Removing release from: Activiti/activiti-cloud-full-chart" gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-full-chart" From 42f6d44f1b0569e4682ab210c7770d54ce086a14 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:25:52 +0100 Subject: [PATCH 09/27] different approach --- .github/workflows/mock-release-cleanup.yml | 43 ++++++---------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index d6544321..481d0ed4 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -11,48 +11,29 @@ jobs: delete_version: runs-on: ubuntu-latest steps: - - name: Delete version if the provided version ends with "-mock" + - uses: actions/checkout@v3 + with: + repository: Activiti/activiti-cloud-full-chart + token: ${{ secrets.BOT_GITHUB_TOKEN }} + + - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 + id: check-tag + with: + tag: ${{ inputs.version }} + + + - name: Delete release 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 - git config --global user.email "${{ secrets.BOT_GITHUB_USERNAME}}@no-reply.users.github.com" - git config --global user.name "${{ secrets.BOT_GITHUB_USERNAME}}" - echo "Removing release from: Activiti/activiti-cloud-full-chart" gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true echo "Removing tag from: Activiti/activiti-cloud-full-chart" - gh repo clone Activiti/activiti-cloud-full-chart && cd "$(basename "$_" .git)" git push origin --delete ${VERSION} || true - - echo "Removing release from: Activiti/activiti-scripts" - gh release delete -R Activiti/activiti-scripts -y ${VERSION} || true - echo "Removing tag from: Activiti/activiti-scripts" - gh repo clone Activiti/activiti-scripts && cd "$(basename "$_" .git)" - git push origin --delete ${VERSION} || true - - echo "Removing release from: Activiti/activiti-cloud" - gh release delete -R Activiti/activiti-cloud -y ${VERSION} || true - echo "Removing tag from: Activiti/activiti-cloud" - gh repo clone Activiti/activiti-cloud && cd "$(basename "$_" .git)" - git push origin --delete ${VERSION} || true - - echo "Removing release from: Activiti/activiti-cloud-common-chart" - gh release delete -R Activiti/activiti-cloud-common-chart -y ${VERSION} || true - echo "Removing tag from: Activiti/activiti-cloud-common-chart" - gh repo clone Activiti/activiti-cloud-common-chart && cd "$(basename "$_" .git)" - git push origin --delete ${VERSION} || true - - echo "Removing release from: Activiti/activiti" - gh release delete -R Activiti/Activiti -y ${VERSION} || true - echo "Removing tag from: Activiti/activiti" - gh repo clone Activiti/activiti && cd "$(basename "$_" .git)" - git push origin --delete ${VERSION} || true - else echo "version does not end with '-mock'." echo "Error: The provided version does not end with '-mock.'" From 5475d5eb17834941b705ec01f5bbbeded27c8fad Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:35:22 +0100 Subject: [PATCH 10/27] refactor --- .../remove-mock-release-and-tag/action.yml | 51 +++++++++++++++++++ .github/workflows/mock-release-cleanup.yml | 29 ++--------- 2 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 .github/actions/remove-mock-release-and-tag/action.yml 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..06c1345b --- /dev/null +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -0,0 +1,51 @@ +name: Mock release cleanup +description: Removal of release and tag +inputs: + version: + description: 'Mock release version to be removed from tags and releases' + required: true + repo: + description: 'Path to repo' + required: true + +jobs: + delete_version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ inputs.repo }} + token: ${{ secrets.BOT_GITHUB_TOKEN }} + + - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 + id: check-tag + with: + tag: ${{ inputs.version }} + + + - name: Delete release if the provided version ends with "-mock" + id: delete_version + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + VERSION: ${{ inputs.version }} + REPO: ${{ inputes.repo }} + run: | + if [[ "${VERSION}" == *-mock ]]; then + echo "Removing release from: ${REPO}" + gh release delete -R ${REPO} -y ${VERSION} || true + else + echo "version does not end with '-mock'." + echo "Error: The provided version does not end with '-mock.'" + exit 1 + fi + + - name: Delete tag if it exist + if: steps.check-tag.outputs.exists == 'true' + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + VERSION: ${{ inputs.version }} + run: | + echo "Removing tag from: ${REPO}" + git push origin --delete ${VERSION} || true diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 481d0ed4..a793f31a 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -11,31 +11,8 @@ jobs: delete_version: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: ./.github/actions/remove-mock-release-and-tag with: - repository: Activiti/activiti-cloud-full-chart - token: ${{ secrets.BOT_GITHUB_TOKEN }} + version: ${{ inputs.version }} + repo: Activiti/activiti-cloud-full-chart - - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 - id: check-tag - with: - tag: ${{ inputs.version }} - - - - name: Delete release if the provided version ends with "-mock" - id: delete_version - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - VERSION: ${{ inputs.version }} - run: | - if [[ "${VERSION}" == *-mock ]]; then - echo "Removing release from: Activiti/activiti-cloud-full-chart" - gh release delete -R Activiti/activiti-cloud-full-chart -y ${VERSION} || true - echo "Removing tag from: Activiti/activiti-cloud-full-chart" - git push origin --delete ${VERSION} || true - else - echo "version does not end with '-mock'." - echo "Error: The provided version does not end with '-mock.'" - exit 1 - fi From 16ee16beab7f3741a36f0ba6b6da18d715ce4948 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:36:23 +0100 Subject: [PATCH 11/27] refactor --- .../remove-mock-release-and-tag/action.yml | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 06c1345b..99775759 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -7,45 +7,43 @@ inputs: repo: description: 'Path to repo' required: true +runs: + using: composite + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ inputs.repo }} + token: ${{ secrets.BOT_GITHUB_TOKEN }} -jobs: - delete_version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - repository: ${{ inputs.repo }} - token: ${{ secrets.BOT_GITHUB_TOKEN }} + - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 + id: check-tag + with: + tag: ${{ inputs.version }} - - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 - id: check-tag - with: - tag: ${{ inputs.version }} + - name: Delete release if the provided version ends with "-mock" + id: delete_version + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + VERSION: ${{ inputs.version }} + REPO: ${{ inputes.repo }} + run: | + if [[ "${VERSION}" == *-mock ]]; then + echo "Removing release from: ${REPO}" + gh release delete -R ${REPO} -y ${VERSION} || true + else + echo "version does not end with '-mock'." + 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: ${{ secrets.BOT_GITHUB_TOKEN }} - VERSION: ${{ inputs.version }} - REPO: ${{ inputes.repo }} - run: | - if [[ "${VERSION}" == *-mock ]]; then - echo "Removing release from: ${REPO}" - gh release delete -R ${REPO} -y ${VERSION} || true - else - echo "version does not end with '-mock'." - echo "Error: The provided version does not end with '-mock.'" - exit 1 - fi - - - name: Delete tag if it exist - if: steps.check-tag.outputs.exists == 'true' - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - VERSION: ${{ inputs.version }} - run: | - echo "Removing tag from: ${REPO}" - git push origin --delete ${VERSION} || true + - name: Delete tag if it exist + if: steps.check-tag.outputs.exists == 'true' + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + VERSION: ${{ inputs.version }} + run: | + echo "Removing tag from: ${REPO}" + git push origin --delete ${VERSION} || true From e6c9da67b0ac6944bc7b3be525838fa3b6a59f36 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:38:08 +0100 Subject: [PATCH 12/27] format --- .github/workflows/mock-release-cleanup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index a793f31a..af70f896 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -15,4 +15,3 @@ jobs: with: version: ${{ inputs.version }} repo: Activiti/activiti-cloud-full-chart - From d89334f6ffeeaa2ee7e19b09fa57e9cea6caec8d Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:39:28 +0100 Subject: [PATCH 13/27] typo --- .github/workflows/mock-release-cleanup.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index af70f896..80a4ed2a 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -11,6 +11,7 @@ jobs: delete_version: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 - uses: ./.github/actions/remove-mock-release-and-tag with: version: ${{ inputs.version }} From 052a841cc95702804f2d52f3c9c2245ff31ccdab Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:43:53 +0100 Subject: [PATCH 14/27] fix --- .github/actions/remove-mock-release-and-tag/action.yml | 9 ++++++--- .github/workflows/mock-release-cleanup.yml | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 99775759..59ad3a40 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -7,13 +7,16 @@ inputs: repo: description: 'Path to repo' required: true + gh-token: + description: 'gh token' + required: true runs: using: composite steps: - uses: actions/checkout@v3 with: repository: ${{ inputs.repo }} - token: ${{ secrets.BOT_GITHUB_TOKEN }} + token: ${{ inputs.token }} - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 id: check-tag @@ -25,9 +28,9 @@ runs: id: delete_version shell: bash env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ inputs.token }} VERSION: ${{ inputs.version }} - REPO: ${{ inputes.repo }} + REPO: ${{ inputs.repo }} run: | if [[ "${VERSION}" == *-mock ]]; then echo "Removing release from: ${REPO}" diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 80a4ed2a..8535f54d 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -16,3 +16,4 @@ jobs: with: version: ${{ inputs.version }} repo: Activiti/activiti-cloud-full-chart + token: ${{ secrets.BOT_GITHUB_TOKEN }} From e5b77fec1145cbdc06fe79e3ccbc3a639483bb7b Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:45:41 +0100 Subject: [PATCH 15/27] fix --- .github/actions/remove-mock-release-and-tag/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 59ad3a40..df837971 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -45,7 +45,7 @@ runs: if: steps.check-tag.outputs.exists == 'true' shell: bash env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ inputs.token }} VERSION: ${{ inputs.version }} run: | echo "Removing tag from: ${REPO}" From 9e5333b9c7e8a6bf03df523fbbed3861053af8a5 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:49:41 +0100 Subject: [PATCH 16/27] fix --- .github/actions/remove-mock-release-and-tag/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index df837971..1625ace6 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -16,7 +16,7 @@ runs: - uses: actions/checkout@v3 with: repository: ${{ inputs.repo }} - token: ${{ inputs.token }} + token: ${{ inputs.gh-token }} - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@v3.6.0 id: check-tag @@ -28,7 +28,7 @@ runs: id: delete_version shell: bash env: - GITHUB_TOKEN: ${{ inputs.token }} + GITHUB_TOKEN: ${{ inputs.gh-token }} VERSION: ${{ inputs.version }} REPO: ${{ inputs.repo }} run: | @@ -45,7 +45,7 @@ runs: if: steps.check-tag.outputs.exists == 'true' shell: bash env: - GITHUB_TOKEN: ${{ inputs.token }} + GITHUB_TOKEN: ${{ inputs.gh-token }} VERSION: ${{ inputs.version }} run: | echo "Removing tag from: ${REPO}" From 32909ef109ec1c1e8ec66ca511259d78c078a6dc Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:51:13 +0100 Subject: [PATCH 17/27] fix --- .github/workflows/mock-release-cleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 8535f54d..b95a92bd 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -16,4 +16,4 @@ jobs: with: version: ${{ inputs.version }} repo: Activiti/activiti-cloud-full-chart - token: ${{ secrets.BOT_GITHUB_TOKEN }} + gh-token: ${{ secrets.BOT_GITHUB_TOKEN }} From bbc20ac367feddf42dede9675705b03b594856d6 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 14:55:30 +0100 Subject: [PATCH 18/27] post checkout --- .github/actions/remove-mock-release-and-tag/action.yml | 1 - .github/workflows/mock-release-cleanup.yml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 1625ace6..ca1f6201 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -23,7 +23,6 @@ runs: with: tag: ${{ inputs.version }} - - name: Delete release if the provided version ends with "-mock" id: delete_version shell: bash diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index b95a92bd..c5f15556 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -17,3 +17,4 @@ jobs: version: ${{ inputs.version }} repo: Activiti/activiti-cloud-full-chart gh-token: ${{ secrets.BOT_GITHUB_TOKEN }} + - uses: actions/checkout@v3 From cc36d46e6f58a41cc4d09e8f8998a4c16d376af2 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 20:41:15 +0100 Subject: [PATCH 19/27] refactor --- .github/workflows/mock-release-cleanup.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index c5f15556..ec73e759 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -10,11 +10,18 @@ on: jobs: delete_version: runs-on: ubuntu-latest + strategy: + matrix: + repository: [ 'Activiti/activiti-cloud-full-chart', + 'Activiti/activiti-scripts', + 'Activiti/activiti-cloud', + 'Activiti/activiti-cloud-common-chart', + 'Activiti/activiti' ] steps: - uses: actions/checkout@v3 - uses: ./.github/actions/remove-mock-release-and-tag with: version: ${{ inputs.version }} - repo: Activiti/activiti-cloud-full-chart + repo: ${{ matrix.repository }} gh-token: ${{ secrets.BOT_GITHUB_TOKEN }} - uses: actions/checkout@v3 From 3e95a3b6eb551fa5836e5c52416b91d7f359dc6e Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 20:51:28 +0100 Subject: [PATCH 20/27] better logs+pinning --- .../actions/remove-mock-release-and-tag/action.yml | 12 ++++++------ .github/workflows/mock-release-cleanup.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index ca1f6201..4c3683bb 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -13,12 +13,12 @@ inputs: runs: using: composite steps: - - uses: actions/checkout@v3 + - 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@v3.6.0 + - uses: Alfresco/alfresco-build-tools/.github/actions/git-check-existing-tag@34b2301fc6245fa98ed73a82e04d4f9ab4eb5a3f #v3.6.0 id: check-tag with: tag: ${{ inputs.version }} @@ -32,8 +32,8 @@ runs: REPO: ${{ inputs.repo }} run: | if [[ "${VERSION}" == *-mock ]]; then - echo "Removing release from: ${REPO}" - gh release delete -R ${REPO} -y ${VERSION} || true + echo "Removing '${VERSION}' release from: ${REPO}" + gh release delete -R ${REPO} -y ${VERSION} else echo "version does not end with '-mock'." echo "Error: The provided version does not end with '-mock.'" @@ -47,5 +47,5 @@ runs: GITHUB_TOKEN: ${{ inputs.gh-token }} VERSION: ${{ inputs.version }} run: | - echo "Removing tag from: ${REPO}" - git push origin --delete ${VERSION} || true + echo "Removing '${VERSION}' tag from: ${REPO}" + git push origin --delete ${VERSION} diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index ec73e759..9deeacc6 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -18,10 +18,10 @@ jobs: 'Activiti/activiti-cloud-common-chart', 'Activiti/activiti' ] steps: - - uses: actions/checkout@v3 + - 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@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 From e2ade1d634f3228771b805e9d4b985583802a13e Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 20:56:01 +0100 Subject: [PATCH 21/27] fail safe to false, reorder --- .../remove-mock-release-and-tag/action.yml | 20 +++++++++---------- .github/workflows/mock-release-cleanup.yml | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 4c3683bb..9ce91fe1 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -23,6 +23,16 @@ runs: with: tag: ${{ inputs.version }} + - name: Delete tag if it exist + if: steps.check-tag.outputs.exists == 'true' + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.gh-token }} + VERSION: ${{ inputs.version }} + run: | + echo "Removing '${VERSION}' tag from: ${REPO}" + git push origin --delete ${VERSION} + - name: Delete release if the provided version ends with "-mock" id: delete_version shell: bash @@ -39,13 +49,3 @@ runs: echo "Error: The provided version does not end with '-mock.'" exit 1 fi - - - name: Delete tag if it exist - if: steps.check-tag.outputs.exists == 'true' - shell: bash - env: - GITHUB_TOKEN: ${{ inputs.gh-token }} - VERSION: ${{ inputs.version }} - run: | - echo "Removing '${VERSION}' tag from: ${REPO}" - git push origin --delete ${VERSION} diff --git a/.github/workflows/mock-release-cleanup.yml b/.github/workflows/mock-release-cleanup.yml index 9deeacc6..079f62b8 100644 --- a/.github/workflows/mock-release-cleanup.yml +++ b/.github/workflows/mock-release-cleanup.yml @@ -11,6 +11,7 @@ jobs: delete_version: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: repository: [ 'Activiti/activiti-cloud-full-chart', 'Activiti/activiti-scripts', From 3d357f7150c2feeba9b5f8ad4d7b1990a9ef41c5 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 21:01:47 +0100 Subject: [PATCH 22/27] extra check --- .../actions/remove-mock-release-and-tag/action.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 9ce91fe1..85daf760 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -23,15 +23,21 @@ runs: with: tag: ${{ inputs.version }} - - name: Delete tag if it exist + - 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: | - echo "Removing '${VERSION}' tag from: ${REPO}" - git push origin --delete ${VERSION} + if [[ "${VERSION}" == *-mock ]]; then + echo "Removing '${VERSION}' tag from: ${REPO}" + git push origin --delete ${VERSION} + else + echo "version does not end with '-mock'." + 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 From 0f0c076443509d128f8ad9fa5b7cf08e88981d34 Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 8 Nov 2023 21:14:43 +0100 Subject: [PATCH 23/27] repo activiti-scripts added to matrix responsible for creating gh releases --- .github/workflows/run-release.yml | 1 + 1 file changed, 1 insertion(+) 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 }} From 99b075aa595b7b18c1145db1b7863c4765322be7 Mon Sep 17 00:00:00 2001 From: Wojtek Piotrowiak Date: Fri, 10 Nov 2023 14:07:51 +0100 Subject: [PATCH 24/27] Apply suggestions from code review Co-authored-by: Anahide Tchertchian <608958+atchertchian@users.noreply.github.com> --- .github/actions/remove-mock-release-and-tag/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 85daf760..9bdc7325 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -1,14 +1,14 @@ name: Mock release cleanup -description: Removal of release and tag +description: Remove mock release and tag on a repository inputs: version: - description: 'Mock release version to be removed from tags and releases' + description: Mock release version to be removed from tags and releases (should end with -mock) required: true repo: - description: 'Path to repo' + description: Path the repository required: true gh-token: - description: 'gh token' + description: 'GitHub Token' required: true runs: using: composite From 51122cb1503e38408bbaca02cb282f204d95c84f Mon Sep 17 00:00:00 2001 From: Wojtek Piotrowiak Date: Fri, 10 Nov 2023 14:07:51 +0100 Subject: [PATCH 25/27] logs fix --- .github/actions/remove-mock-release-and-tag/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index 9bdc7325..d2c0628d 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -51,7 +51,6 @@ runs: echo "Removing '${VERSION}' release from: ${REPO}" gh release delete -R ${REPO} -y ${VERSION} else - echo "version does not end with '-mock'." echo "Error: The provided version does not end with '-mock.'" exit 1 fi From 2d4aeec303f5fbb894020168658e0a1893feab24 Mon Sep 17 00:00:00 2001 From: Wojtek Piotrowiak Date: Wed, 15 Nov 2023 20:07:18 +0100 Subject: [PATCH 26/27] Update .github/actions/remove-mock-release-and-tag/action.yml Co-authored-by: Anahide Tchertchian <608958+atchertchian@users.noreply.github.com> --- .github/actions/remove-mock-release-and-tag/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index d2c0628d..b2b9590a 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -32,7 +32,7 @@ runs: run: | if [[ "${VERSION}" == *-mock ]]; then echo "Removing '${VERSION}' tag from: ${REPO}" - git push origin --delete ${VERSION} + git push origin --delete ${VERSION} || true else echo "version does not end with '-mock'." echo "Error: The provided version does not end with '-mock.'" From 6cba7efcc7441dac24398f789002c2073afa67fe Mon Sep 17 00:00:00 2001 From: Wojciech Piotrowiak Date: Wed, 15 Nov 2023 20:08:12 +0100 Subject: [PATCH 27/27] double echo removed --- .github/actions/remove-mock-release-and-tag/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/remove-mock-release-and-tag/action.yml b/.github/actions/remove-mock-release-and-tag/action.yml index b2b9590a..278f94bc 100644 --- a/.github/actions/remove-mock-release-and-tag/action.yml +++ b/.github/actions/remove-mock-release-and-tag/action.yml @@ -34,7 +34,6 @@ runs: echo "Removing '${VERSION}' tag from: ${REPO}" git push origin --delete ${VERSION} || true else - echo "version does not end with '-mock'." echo "Error: The provided version does not end with '-mock.'" exit 1 fi