Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a51db6

Browse files
authored
Merge pull request #15 from N6REJ/versioning
Improve version generation logic and add Julian Clock language config…
2 parents 5b5c9af + 5260847 commit 7a51db6

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

.github/workflows/package-module.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,34 @@ jobs:
7070
BASE_VERSION=$(date +'%Y.%m.%d')
7171
CREATION_DATE=$(date +'%Y %B %d')
7272
CURRENT_YEAR=$(date +'%Y')
73-
74-
# Get all existing tags
75-
git fetch --tags
76-
77-
# Check if the base version tag already exists
78-
if git rev-parse "$BASE_VERSION" >/dev/null 2>&1; then
79-
echo "Tag $BASE_VERSION already exists, finding next available version..."
80-
81-
# Find all tags that match the pattern {BASE_VERSION}.{n}
82-
MATCHING_TAGS=$(git tag -l "$BASE_VERSION.*")
83-
84-
if [ -z "$MATCHING_TAGS" ]; then
85-
# No sub-versions exist, use .1
86-
VERSION="${BASE_VERSION}.1"
87-
else
88-
# Find the highest sub-version
89-
HIGHEST_SUBVERSION=$(echo "$MATCHING_TAGS" | sed "s/^$BASE_VERSION\.//" | sort -n | tail -1)
90-
NEXT_SUBVERSION=$((HIGHEST_SUBVERSION + 1))
91-
VERSION="${BASE_VERSION}.$NEXT_SUBVERSION"
92-
fi
73+
74+
# Fetch all tags from remote to ensure we have the latest
75+
git fetch --tags --force
76+
77+
# Find all tags that match the pattern BASE_VERSION or BASE_VERSION.n
78+
TAGS=$(git tag -l "${BASE_VERSION}*" | sort -V)
79+
80+
if echo "$TAGS" | grep -qx "$BASE_VERSION"; then
81+
# If the base version exists, find the highest subversion
82+
HIGHEST_SUBVERSION=0
83+
for tag in $TAGS; do
84+
if [[ "$tag" =~ ^${BASE_VERSION}\.([0-9]+)$ ]]; then
85+
SUBVER=${BASH_REMATCH[1]}
86+
if (( SUBVER > HIGHEST_SUBVERSION )); then
87+
HIGHEST_SUBVERSION=$SUBVER
88+
fi
89+
fi
90+
done
91+
NEXT_SUBVERSION=$((HIGHEST_SUBVERSION + 1))
92+
VERSION="${BASE_VERSION}.${NEXT_SUBVERSION}"
9393
else
9494
VERSION="$BASE_VERSION"
9595
fi
96-
96+
9797
echo "Generated version: $VERSION"
9898
echo "Creation date: $CREATION_DATE"
9999
echo "Current year: $CURRENT_YEAR"
100-
100+
101101
# Set outputs for use later
102102
echo "version=$VERSION" >> $GITHUB_OUTPUT
103103
echo "creation_date=$CREATION_DATE" >> $GITHUB_OUTPUT
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
MOD_JULIANCLOCK="Astronomical Julian Clock"
22
MOD_JULIANCLOCK_DESC="A simple Julian Clock for Astronomers. Updated for Joomla 5 compatibility."
3+
MOD_JULIANCLOCK_CLOCK_TEXT_LABEL="Clock text"
4+
MOD_JULIANCLOCK_CLOCK_TEXT_DESC="This text will appear after the time. Include spaces as desired"
5+
MOD_JULIANCLOCK_POSITION_TEXT_LABEL="Show Text before Date?"
6+
MOD_JULIANCLOCK_POSTION_TEXT_DESC="Will the text entered be shown before or after the time?"
7+
MOD_JULIANCLOCK_UPDATE_INTERVAL_LABEL="Update Interval"
8+
MOD_JULIANCLOCK_UPDATE_INTERVAL_DESC="How often would you like the clock to update? - NOTE: Value is in milliseconds, there are 1000 milliseconds in a second?"
9+
MOD_JULIANCLOCK_ICON_LABEL="Icon Class"
10+
MOD_JULIANCLOCK_ICON_DESC="You can display a fontawesom, icon-moon, or glyphicon here by
11+
simply pasting in the class's given in the cheatsheet for the given icon.<br>For example, for a glyphicon asterisk you would enter <i>glyphicon glyphicon-asterisk</i>.<br>
12+
NOTE: The icon will ALWAYS appear on the far left"
13+
MOD_JULIANCLOCK_PRECISION_LABEL="Decimal Display"
14+
MOD_JULIANCLOCK_PRECISION_DESC="You may have up to a 10 digit decimal precision. Choose the number of decimal places you wish to display.<br>NOTE: computations are done in 64bit values but rounded to 10 places."

0 commit comments

Comments
 (0)