Skip to content

Commit 4c47ef2

Browse files
committed
try to use github
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
1 parent 3f8420e commit 4c47ef2

1 file changed

Lines changed: 16 additions & 21 deletions

File tree

action.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,25 @@ runs:
3838
echo "Error: Current major.minor is greater than the version in the VERSION file." >&2
3939
exit 1
4040
fi
41-
42-
# Check if running on GitHub Actions and required environment variables are set
43-
if [[ -n "$GITHUB_SHA" && -n "$GITHUB_REF" && -n "$GITHUB_RUN_NUMBER" ]]; then
44-
sha="$GITHUB_SHA"
45-
ref="$GITHUB_REF"
46-
build_number="$GITHUB_RUN_NUMBER"
4741
48-
# Convert the short hash to a numeric value
49-
short_hash=$(printf "%08d" $((16#${sha:0:6})))
42+
# handle GitHub Actions context
43+
sha="$GITHUB_SHA"
44+
ref="$GITHUB_REF"
45+
build_number="$GITHUB_RUN_NUMBER"
5046
51-
if [[ "$ref" == *"main"* ]]; then
52-
# Main branch: keep the version as is
53-
echo "$new_version"
54-
else
55-
# Feature branch: append alpha versioning
56-
echo "${new_version}a1${build_number}${short_hash}"
57-
fi
47+
# Convert the short hash to a numeric value
48+
short_hash=$(printf "%08d" $((16#${sha:0:6})))
49+
50+
if [[ "$ref" == *"main"* ]]; then
51+
# Main branch: keep the version as is
52+
echo "$new_version"
5853
else
59-
echo "Error: Required GitHub Actions environment variables are not set." >&2
60-
exit 1
54+
# Feature branch: append alpha versioning
55+
echo "${new_version}a1${build_number}${short_hash}"
6156
fi
6257
}
6358
64-
# Run the bump_version function with the latest tag
65-
new_version=$(bump_version "${{ steps.fetch_tag.outputs.release }}")
66-
# Save the new version to PYPI_VERSION file
67-
echo "$new_version" > PYPI_VERSION
59+
# Run the bump_version function with the latest tag
60+
new_version=$(bump_version "${{ steps.fetch_tag.outputs.release }}")
61+
# Save the new version to PYPI_VERSION file
62+
echo "$new_version" > PYPI_VERSION

0 commit comments

Comments
 (0)