matrei commented on code in PR #22:
URL: 
https://github.com/apache/grails-github-actions/pull/22#discussion_r2147340363


##########
deploy-github-pages/entrypoint.sh:
##########
@@ -224,23 +224,36 @@ if [[ "$GRADLE_PUBLISH_RELEASE" == "false" ]]; then
 else
   echo "Release detected"
 
-  versionFolder="${VERSION%.*}"
-  versionFolder="${versionFolder}.x"
-  echo "Version folder will be ${versionFolder}"
-
-  # Publish to the version folder first
-  BASE_PUBLISH_PATH="./${versionFolder}"
+  # Publish to the specific version folder
+  echo "::group::Publishing Specific Version: ${VERSION}"
+  BASE_PUBLISH_PATH="./${VERSION}"
   if [ -n "${TARGET_SUBFOLDER}" ]; then
-    PUBLISH_PATH="./${versionFolder}/${TARGET_SUBFOLDER}"
+    PUBLISH_PATH="./${VERSION}/${TARGET_SUBFOLDER}"
   else    
-    PUBLISH_PATH="./${versionFolder}"
+    PUBLISH_PATH="./${VERSION}"
   fi
   publish_artifacts
   echo "Published documentation to ${PUBLISH_PATH}"
+  echo "::endgroup::"
+
+  # Publish to the generic version folder
+  genericVersionFolder="${VERSION%.*}"
+  genericVersionFolder="${versionFolder}.x"

Review Comment:
   I this supposed to use `versionFolder` and not `genericVersionFolder`?
   Won't that render the previous line unused?



##########
post-release/action.yml:
##########
@@ -114,7 +114,8 @@ runs:
         git checkout -b "${MERGE_BRANCH_NAME}" "${GITHUB_REF}"
 
         echo "Setting new snapshot version"
-        sed -i 
"s/^projectVersion.*$/projectVersion\=${NEXT_VERSION}-SNAPSHOT/" 
gradle.properties
+        sed -i 
"s/^projectVersion\=.*$/projectVersion\=${NEXT_VERSION}-SNAPSHOT/" 
gradle.properties
+        sed -i "s/^version\=.*$/projectVersion\=${NEXT_VERSION}-SNAPSHOT/" 
gradle.properties

Review Comment:
   Is this line supposed to replace `version` with `projectVersion`?



##########
post-release/action.yml:
##########
@@ -6,7 +6,155 @@ inputs:
     required: true
     default: ${{ github.token }}
 runs:
-  using: 'docker'
-  image: 'Dockerfile'
-  args:
-    - ${{ inputs.token }}
\ No newline at end of file
+  using: 'composite'
+  steps:
+    - name: 'Post Release - Revert Snapshot Version'

Review Comment:
   This reads clearer to me: Revert back to Snapshot Version



##########
post-release/action.yml:
##########
@@ -6,7 +6,155 @@ inputs:
     required: true
     default: ${{ github.token }}
 runs:
-  using: 'docker'
-  image: 'Dockerfile'
-  args:
-    - ${{ inputs.token }}
\ No newline at end of file
+  using: 'composite'
+  steps:
+    - name: 'Post Release - Revert Snapshot Version'
+      shell: bash
+      env:
+        GITHUB_TOKEN: ${{ inputs.token }}
+      run: |
+        #!/bin/bash
+
+        # The following permissions are required to successfully execute this 
script:
+        # permissions:
+        #    issues: write # to close milestone (script will silently fail if 
not set)
+        #    contents: write # to commit
+        #
+        # This script expects the github action to have checked out the 
repository with fetch-depth: 0
+
+        set_value_or_error() {
+          local value="$1"
+          local defaultValue="$2"
+          local variableName="$3"
+          local validValues="${4:-}"  # optional argument (if empty, skip 
validation)
+
+          if [[ -z "$value" && -z "$defaultValue" ]]; then
+            echo "ERROR: A value for $variableName is required." >&2
+            exit 1
+          fi
+
+          if [[ -n "$value" ]]; then
+            decidedValue="$value"
+          else
+            echo "${variableName}: Using default value: ${defaultValue}"
+            decidedValue="$defaultValue"
+          fi
+
+          if [[ -n "$validValues" ]]; then
+            local match=false
+            local v
+            for v in $validValues; do
+              if [[ "$decidedValue" == "$v" ]]; then
+                match=true
+                break
+              fi
+            done
+
+            if ! $match; then
+              echo "ERROR: Invalid value for '$variableName': 
'$decidedValue'." >&2
+              echo "       Must be one of: $validValues" >&2
+              return 1
+            fi
+          fi
+
+          eval "export $variableName=\"\$decidedValue\""
+        }
+
+        set -e
+
+        set_value_or_error "${GIT_USER_NAME}" "${GITHUB_ACTOR}" "GIT_USER_NAME"
+        set_value_or_error "${GITHUB_WORKSPACE}" "." "GIT_SAFE_DIR"
+        set_value_or_error "${GITHUB_REPOSITORY}" "" "GITHUB_REPOSITORY"
+        set_value_or_error "${RELEASE_VERSION}" "${GITHUB_REF:11}" 
"RELEASE_VERSION"
+
+        if [[ ! "${RELEASE_VERSION}" =~ ^v?[^.]+\.[^.]+\.[^.]+$ ]]; then

Review Comment:
   This will not allow branches named for example `6.x` (without the patch 
part). We hit that in https://github.com/grails-plugins/grails-cache-redis 
where we had to rename to `6.x` to `6.0.x`. I don't know if we want to support 
`6.x`, I just wanted to mention it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to