You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/07/07 18:46:50 UTC

(grails-core) branch 7.0.x updated: [skip ci] ci: add abort release workflow

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 35c81a4d71 [skip ci] ci: add abort release workflow
35c81a4d71 is described below

commit 35c81a4d71068b5f2eda16b23c6a829a53eec401
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Mon Jul 7 14:46:43 2025 -0400

    [skip ci] ci: add abort release workflow
---
 .github/workflows/release-abort-release.yml | 100 ++++++++++++++++++++++++++++
 .github/workflows/release.yml               |   3 +
 2 files changed, 103 insertions(+)

diff --git a/.github/workflows/release-abort-release.yml b/.github/workflows/release-abort-release.yml
new file mode 100644
index 0000000000..8084caf7ac
--- /dev/null
+++ b/.github/workflows/release-abort-release.yml
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: "Release - Abort Release"
+on:
+  workflow_dispatch:
+    inputs:
+      release_tag:
+        description: 'Release tag (e.g., v7.0.0-M5)'
+        required: true
+        type: string
+      repository_name:
+        description: 'Repository Name'
+        required: true
+        default: 'grails-core'
+        type: string
+jobs:
+  dropStaging:
+    name: "Drop Staging Repository"
+    runs-on: ubuntu-latest
+    steps:
+      - name: "Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it
+        run: curl -s https://api.ipify.org
+      - name: "Setup SVN and Tools"
+        run: sudo apt-get install -y subversion subversion-tools tree
+      - name: "Extract release version"
+        id: release_version
+        run: |
+          version="${{ github.event.inputs.release_tag }}"
+          version="${version#v}"
+          echo "Extracted version: $version"
+          echo "value=${version}" >> $GITHUB_OUTPUT
+      - name: "Drop staging repository from Nexus"
+        env:
+          NEXUS_STAGE_DEPLOYER_USER: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }}
+          NEXUS_STAGE_DEPLOYER_PW: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}
+        run: |
+          export REPO_DESCRIPTION="${{ github.event.inputs.repository_name }}:${{ steps.release_version.outputs.value }}"
+          export STAGING_REPOSITORY_ID=$(curl -s -u "$NEXUS_STAGE_DEPLOYER_USER:$NEXUS_STAGE_DEPLOYER_PW" \
+            "https://repository.apache.org/service/local/staging/profile_repositories/${{ secrets.STAGING_PROFILE_ID }}" |
+            jq -r '.data[] | select(.description=="'"$DESC"'") | .repositoryId')
+          
+          test -n "$STAGING_REPOSITORY_ID" || { echo "No repo with that description"; exit 1; }
+          
+          response=$(curl -s --request POST -u "$NEXUS_STAGE_DEPLOYER_USER:$NEXUS_STAGE_DEPLOYER_PW" \
+            --url https://repository.apache.org/service/local/staging/bulk/drop \
+            --header 'Content-Type: application/json' \
+            --header 'Accept: application/json' \
+            --header 'User-Agent: Grails Github Actions' \
+            --data '{ "data" : {"stagedRepositoryIds":["'"$STAGING_REPOSITORY_ID"'"], "description":"Drop '"$STAGING_REPOSITORY_ID"'." } }')
+
+          if [ ! -z "$response" ]; then
+              echo "Error while dropping staged repository $STAGING_REPOSITORY_ID : $response."
+              exit 1
+          else
+              echo "Successfully dropped repository $STAGING_REPOSITORY_ID."
+          fi
+      - name: "Remove Staged Artifacts"
+        env:
+          SVN_USERNAME: ${{ secrets.SVC_DIST_GRAILS_USERNAME }}
+          SVN_PASSWORD: ${{ secrets.SVC_DIST_GRAILS_PASSWORD }}
+        run: |
+          export VERSION="${{ needs.publish.outputs.release_version }}"
+          svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive https://dist.apache.org/repos/dist/dev/incubator/grails/core dev-repo
+          cd dev-repo
+          svn delete "$VERSION"
+          svn commit -m "Remove grails dev version $VERSION" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive
+      - name: "Remove GitHub Release & Tag"
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAG: ${{ github.event.inputs.release_tag }}
+          OWNER: ${{ github.repository_owner }}
+          REPO: ${{ github.event.inputs.repository_name }}
+        run: |
+          set -euo pipefail
+          
+          release_json="$(gh api -H 'Accept: application/vnd.github+json' "/repos/$OWNER/$REPO/releases/tags/$TAG" || true)"
+          if [ -n "$release_json" ]; then
+              release_id=$(jq -r '.id' <<<"$release_json")
+              echo "Deleting release $release_id linked to tag $TAG"
+              gh api -X DELETE "/repos/$OWNER/$REPO/releases/$release_id"
+          else
+              echo "No GitHub release found for tag $TAG – skipping release deletion"
+          fi
+          
+          ref="tags/$TAG"
+          echo "Deleting git ref $ref"
+          gh api -X DELETE "/repos/$OWNER/$REPO/git/refs/$ref" || echo "Tag $TAG already absent"
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d3e0454874..a981ec9594 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -343,6 +343,9 @@ jobs:
   upload:
     needs: [ publish, source ]
     runs-on: ubuntu-24.04
+    env:
+      SVN_USERNAME: ${{ secrets.SVC_DIST_GRAILS_USERNAME }}
+      SVN_PASSWORD: ${{ secrets.SVC_DIST_GRAILS_PASSWORD }}
     steps:
       - name: "Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it
         run: curl -s https://api.ipify.org