Skip to content

Commit a53f43f

Browse files
committed
Update release Webhook
1 parent f669036 commit a53f43f

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,35 @@ jobs:
4545
run: |
4646
# Get the version for game-versions field
4747
VERSION="${{ steps.artifact.outputs.version }}"
48-
# Extract just the Minecraft version (e.g., 1.20.4 from v1.20.4)
49-
MC_VERSION=$(echo "$VERSION" | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?')
50-
echo "minecraft_version=${MC_VERSION}" >> $GITHUB_OUTPUT
51-
echo "Minecraft version: ${MC_VERSION}"
48+
49+
# Check if version contains 'x' (wildcard)
50+
if [[ "$VERSION" == *".x"* ]]; then
51+
# It's a wildcard version like 1.21.x
52+
# Extract base version (e.g., 1.21 from 1.21.x)
53+
BASE_VERSION=$(echo "$VERSION" | sed 's/\.x$//' | grep -oE '[0-9]+\.[0-9]+')
54+
55+
# Calculate next minor version for upper bound
56+
MAJOR=$(echo "$BASE_VERSION" | cut -d. -f1)
57+
MINOR=$(echo "$BASE_VERSION" | cut -d. -f2)
58+
NEXT_MINOR=$((MINOR + 1))
59+
NEXT_VERSION="${MAJOR}.${NEXT_MINOR}"
60+
61+
# Create version range: [1.20,1.21)
62+
# [1.20 = includes 1.20 and higher
63+
# ,1.21) = but excludes 1.21 and higher
64+
# Result: 1.20, 1.20.1, 1.20.2, ..., 1.20.99 (all 1.20.x versions)
65+
VERSIONS="[${BASE_VERSION},${NEXT_VERSION})"
66+
67+
echo "minecraft_versions=${VERSIONS}" >> $GITHUB_OUTPUT
68+
echo "Minecraft versions (wildcard): ${VERSIONS} (includes ALL ${BASE_VERSION}.x versions including ${BASE_VERSION} itself)"
69+
else
70+
# It's a specific version like 1.21.4 or 1.21
71+
MC_VERSION=$(echo "$VERSION" | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?')
72+
73+
# Just use the exact version - 1.21 is 1.21, 1.21.4 is 1.21.4
74+
echo "minecraft_versions=${MC_VERSION}" >> $GITHUB_OUTPUT
75+
echo "Minecraft version: ${MC_VERSION} (exact)"
76+
fi
5277
5378
- name: Upload to Modrinth & Curseforge
5479
uses: Kir-Antipov/[email protected]
@@ -65,7 +90,7 @@ jobs:
6590
version: msa-${{ steps.artifact.outputs.version }}
6691
version-type: release
6792
game-versions: |
68-
${{ steps.game_version.outputs.minecraft_version }}
93+
${{ steps.game_version.outputs.minecraft_versions }}
6994
loaders: |
7095
paper
7196
spigot
@@ -78,7 +103,7 @@ jobs:
78103
- Includes all current features and bugfixes
79104
80105
### Minecraft Version
81-
Supports Minecraft ${{ steps.game_version.outputs.minecraft_version }}
106+
Supports Minecraft ${{ steps.artifact.outputs.version }}
82107
83108
### Installation
84109
Download the JAR file and place it in your Minecraft server's `plugins` folder.

0 commit comments

Comments
 (0)