Skip to content

Commit 08e0005

Browse files
feat(release): use latest tag from ordered list as previous semantic version
1 parent 670b1d1 commit 08e0005

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

.github/workflows/release.yml

+1-42
Original file line numberDiff line numberDiff line change
@@ -212,51 +212,10 @@ jobs:
212212
213213
current_semantic_version="${{github.ref_name}}"
214214
215-
previous_semantic_version=""
216-
highest_version=""
217-
218-
# Function to compare semantic versions
219-
compare_versions() {
220-
local version1="$1"
221-
local version2="$2"
222-
if [[ "$version1" == "$version2" ]]; then
223-
echo "equal"
224-
else
225-
if [[ "$version1" < "$version2" ]]; then
226-
echo "less"
227-
else
228-
echo "greater"
229-
fi
230-
fi
231-
}
232-
233215
# Sort the list of tags in ascending order
234216
sorted_tags=($(printf "%s\n" "${semantic_version_tags[@]}" | sort -V))
235217
236-
# Iterate through the sorted list of tags
237-
for tag in "${sorted_tags[@]}"; do
238-
echo $tag
239-
240-
comparison_result=$(compare_versions "$tag" "$current_semantic_version")
241-
242-
# If the current tag is less than or equal to the current semantic version and greater than the highest version found so far
243-
if [ "$comparison_result" != "greater" ] && [ "$comparison_result" != "equal" ] && [ "$comparison_result" == "less" ]; then
244-
highest_version="$tag"
245-
fi
246-
247-
# If the current tag is equal to the current semantic version, set the previous version to the highest version found
248-
if [ "$comparison_result" == "equal" ]; then
249-
previous_semantic_version="$highest_version"
250-
fi
251-
done
252-
253-
# Print the previous semantic version (if found)
254-
if [ -n "$previous_semantic_version" ]; then
255-
echo "Previous semantic version: $previous_semantic_version"
256-
else
257-
echo "No previous semantic version found."
258-
exit 1
259-
fi
218+
previous_semantic_version=$sorted_tags[-1]
260219
261220
# Download & Install clog-tool/clog-cli
262221
wget https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-x86_64-unknown-linux-gnu.tar.gz

0 commit comments

Comments
 (0)