Skip to content

Commit 0ed94c2

Browse files
committed
Refactor release workflow to simplify Minecraft version extraction and update game versions handling
1 parent 9e7b7be commit 0ed94c2

1 file changed

Lines changed: 12 additions & 33 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,6 @@ jobs:
1818
java-version: '17'
1919
cache: 'maven'
2020

21-
- name: Extract branch name and determine Minecraft version
22-
id: extract_branch
23-
run: |
24-
BRANCH_NAME=${GITHUB_REF_NAME}
25-
echo "Branch name: $BRANCH_NAME"
26-
27-
# Extract Minecraft version from branch name (e.g., 1.19.x -> 1.19)
28-
if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+)\.x ]]; then
29-
MC_VERSION=${BASH_REMATCH[1]}
30-
echo "Detected Minecraft version: $MC_VERSION"
31-
echo "mc_version=$MC_VERSION" >> $GITHUB_OUTPUT
32-
33-
# Create a list of compatible game versions based on the branch
34-
if [[ $MC_VERSION == "1.19" ]]; then
35-
echo "game_versions=1.19,1.19.1,1.19.2,1.19.3,1.19.4" >> $GITHUB_OUTPUT
36-
elif [[ $MC_VERSION == "1.20" ]]; then
37-
echo "game_versions=1.20,1.20.1,1.20.2,1.20.3,1.20.4" >> $GITHUB_OUTPUT
38-
elif [[ $MC_VERSION == "1.21" ]]; then
39-
echo "game_versions=1.21,1.21.1" >> $GITHUB_OUTPUT
40-
elif [[ $MC_VERSION == "1.18" ]]; then
41-
echo "game_versions=1.18,1.18.1,1.18.2" >> $GITHUB_OUTPUT
42-
else
43-
echo "game_versions=$MC_VERSION" >> $GITHUB_OUTPUT
44-
fi
45-
else
46-
echo "Could not determine Minecraft version from branch name: $BRANCH_NAME"
47-
exit 1
48-
fi
49-
5021
- name: Build with Maven
5122
run: mvn clean package -DskipTests
5223

@@ -67,13 +38,21 @@ jobs:
6738

6839
files: ${{ steps.artifact.outputs.jar_path }}
6940

70-
name: MinecraftServerAPI ${GITHUB_REF_NAME}
71-
version: ${GITHUB_REF_NAME}-${{ steps.artifact.outputs.version }}
41+
name: MinecraftServerAPI ${{ github.ref_name }}
42+
version: msa-${{ steps.artifact.outputs.version }}
7243
version-type: release
73-
game-versions: ${{ steps.extract_branch.outputs.game_versions }}
44+
game-versions: |
45+
>=1.21
7446
loaders: |
7547
paper
7648
spigot
7749
bukkit
7850
changelog: |
79-
See [GitHub Release](${{ github.event.release.html_url }}) for changelog.
51+
See [GitHub Release](${{ github.event.release.html_url }}) for changelog.
52+
53+
- name: Upload to release
54+
uses: softprops/action-gh-release@v1
55+
with:
56+
files: target/MinecraftServerAPI-*.jar
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)