Skip to content

Commit 5f574ce

Browse files
committed
Typo when creating first tag of repo
1 parent 3c74c1a commit 5f574ce

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

action/action.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
readonly INITIAL_TAG="0.0.0"
4+
35
# Function to compare two semver versions
46
# Returns 1 if $1 > $2, 0 if $1 == $2, -1 if $1 < $2
57
semver_compare() {
@@ -130,23 +132,22 @@ latest_tag=$(semver_get_latest)
130132
if [[ -z "${latest_tag}" ]]; then
131133
echo "No valid SemVer tags found. Creating initial tag..."
132134

133-
# Always use 'v' prefix for initial tag (standard convention)
134-
latest_tag="v0.0.0"
135+
latest_tag="$INITIAL_TAG"
135136
echo "Using initial tag: $latest_tag"
136137
else
137138
echo -e "\nLast tag is: $latest_tag\n"
138139
fi
139140

140141
# Generate changelog with git-cliff
141-
if [[ "$latest_tag" == "v0.0.0" ]]; then
142+
if [[ "$latest_tag" == $INITIAL_TAG ]]; then
142143
# For initial tag, get all commits
143144
changelog="$(git cliff --config /action/config.toml)"
144145
else
145146
changelog="$(git cliff --config /action/config.toml "${latest_tag}"..HEAD)"
146147
fi
147148
changelog=$(echo "${changelog}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
148149

149-
if [[ -z "${changelog}" && "$latest_tag" != "v0.0.0" ]]; then
150+
if [[ -z "${changelog}" && "$latest_tag" != $INITIAL_TAG ]]; then
150151
echo "Changelog is empty. Please ensure you have new commits outside latest tag"
151152
exit 0
152153
fi
@@ -157,21 +158,21 @@ if [ "$PREVIEW" = true ]; then
157158
exit 0
158159
fi
159160

160-
if [[ ${latest_tag:0:1} == "v" ]]; then
161-
starts_with_v=true
162-
else
163-
starts_with_v=false
164-
fi
165-
166161
# Use custom tag or provide choice for user to update.
167162
if [[ -n "${CUSTOM_TAG}" ]]; then
168163
NEW_TAG=${CUSTOM_TAG}
169164
else
170165
# Handle initial tag case
171-
if [[ "$latest_tag" == "v0.0.0" ]]; then
166+
if [[ "$latest_tag" == $INITIAL_TAG ]]; then
172167
# Creating initial release tag
173-
NEW_TAG="v0.1.0"
168+
NEW_TAG="0.1.0"
174169
else
170+
if [[ ${latest_tag:0:1} == "v" ]]; then
171+
starts_with_v=true
172+
else
173+
starts_with_v=false
174+
fi
175+
175176
# strip V from tag
176177
major=$(echo "$latest_tag" | cut -d'.' -f1)
177178
major=${major#v}

0 commit comments

Comments
 (0)