Skip to content

Commit 9ba01ec

Browse files
feat: Pass VERBOSE to script (32376)
1 parent 465d4a5 commit 9ba01ec

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: camunda/infra-global-github-actions/previous-version@32376-previous-version-gha-test
1717
with:
1818
version: '1.0.1'
19-
verbose: 'true'
19+
verbose: 'false'
2020
- run: |
2121
echo ${{ steps.prev_version.outputs.previous_version }}
2222
echo ${{ steps.prev_version.outputs.release_type }}

previous-version/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
required: true
1010
verbose:
1111
description: 'Verbose mode (true|false)'
12-
default: 'false'
12+
# default: 'false'
1313
outputs:
1414
previous_version:
1515
description: 'Previous version (e.g. 8.7.0)'
@@ -40,7 +40,7 @@ runs:
4040
set -x
4141
fi
4242
43-
RESULT=$(${{ github.action_path }}/previous_version.sh '${{ inputs.version }}')
43+
RESULT=$(${{ github.action_path }}/previous_version.sh '${{ inputs.version }}' "$VERBOSE")
4444
RELEASE_TYPE=$(echo "$RESULT" | awk '{print $1}')
4545
PREVIOUS_VERSION=$(echo "$RESULT" | awk '{print $2}')
4646
echo "release_type=$RELEASE_TYPE" >> "$GITHUB_OUTPUT"

previous-version/previous_version.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
# E.g. "NORMAL 8.7.0"
1616

1717
PREV_TAG="not found"
18+
VERSION=$1
19+
VERBOSE=$2
20+
21+
if [ "$VERBOSE" = "true" ]; then
22+
set -x
23+
fi
1824

1925
# Function to determine the previous tag using 'NORMAL' logic
2026
determine_normal_prev_tag() {
@@ -147,7 +153,7 @@ get_previous_alpha_tag() {
147153
}
148154

149155
# validation for tag format
150-
if [[ ! $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha[0-9]+(\.[0-9]+)?)?(-rc[0-9]+)?$ ]]; then
156+
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha[0-9]+(\.[0-9]+)?)?(-rc[0-9]+)?$ ]]; then
151157
echo "Release tag is invalid"
152158
exit 1
153159
fi
@@ -157,11 +163,11 @@ ALPHA_PATTERN='-alpha[0-9]+(\.[0-9]+)?$'
157163
RC_PATTERN='-rc[0-9]+$'
158164

159165
TYPE=""
160-
if [[ $1 =~ $NORMAL_PATTERN ]]; then
166+
if [[ $VERSION =~ $NORMAL_PATTERN ]]; then
161167
TYPE="NORMAL"
162-
elif [[ $1 =~ $ALPHA_PATTERN ]]; then
168+
elif [[ $VERSION =~ $ALPHA_PATTERN ]]; then
163169
TYPE="ALPHA"
164-
elif [[ $1 =~ $RC_PATTERN ]]; then
170+
elif [[ $VERSION =~ $RC_PATTERN ]]; then
165171
TYPE="RC"
166172
fi
167173

@@ -172,7 +178,7 @@ fi
172178

173179

174180
# Determine the previous tag
175-
determine_prev_tag "$1" "$TYPE"
181+
determine_prev_tag "$VERSION" "$TYPE"
176182
if [[ -z $PREV_TAG ]]; then
177183
echo "No previous tag found for the given rules"
178184
exit 1

0 commit comments

Comments
 (0)