Skip to content

Commit ac76073

Browse files
committed
Add Fabric JAR build and upload steps to CI workflows
1 parent b5dea46 commit ac76073

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: CI Build and Infrastructure Check
33
# Controls when the workflow will run
44
on:
55
push:
6-
branches: [ master ] # Or your default branch (e.g., master)
6+
branches: [master] # Or your default branch (e.g., master)
77
pull_request:
8-
branches: [ master ] # Or your default branch
8+
branches: [master] # Or your default branch
99

1010
jobs:
1111
# Job to build the plugin and test Docker infrastructure
@@ -37,6 +37,9 @@ jobs:
3737
- name: Build JAR files
3838
run: ./gradlew shadowJar
3939

40+
- name: Build Fabric JAR
41+
run: ./gradlew fabric:build
42+
4043
# Upload Bukkit JAR as an artifact
4144
- name: Upload Bukkit JAR Artifact
4245
uses: actions/upload-artifact@v4
@@ -55,6 +58,15 @@ jobs:
5558
retention-days: 14 # Keep artifacts for 14 days
5659
if-no-files-found: error # Fail the workflow if no JARs are found
5760

61+
# Upload Fabric JAR as an artifact
62+
- name: Upload Fabric JAR Artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: serverpulse-fabric-jar
66+
path: fabric/build/libs/*.jar
67+
retention-days: 14 # Keep artifacts for 14 days
68+
if-no-files-found: error # Fail the workflow if no JARs are found
69+
5870
# --- Infrastructure Testing ---
5971

6072
# 4. Install jq (needed for parsing InfluxDB health check JSON)

.github/workflows/create_release.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ jobs:
3333
uses: gradle/actions/setup-gradle@v4 # Use v4 or latest stable version
3434

3535
# Gradle with the new updates doesn't support arguments
36-
- name: Build jar
36+
- name: Build Bukkit and Velocity jar
3737
run: ./gradlew shadowJar
3838

39+
- name: Build fabric jar
40+
run: ./gradlew fabric:build
41+
3942
# 5. Find the Bukkit Shadow Jar file and extract its name
4043
- name: Find Bukkit Shadow Jar and Extract Name
4144
id: find_bukkit_jar
@@ -68,7 +71,23 @@ jobs:
6871
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
6972
shell: bash
7073

71-
# 7. Upload the Bukkit Shadow Jar as a release asset
74+
# 7. Find the Fabric Jar file and extract its name
75+
- name: Find Fabric Jar and Extract Name
76+
id: find_fabric_jar
77+
run: |
78+
JAR_PATH=$(find fabric/build/libs -maxdepth 1 -name '*.jar' -printf "%s %p\n" | sort -nr | head -n 1 | awk '{print $2}')
79+
if [ -z "$JAR_PATH" ]; then
80+
echo "Error: Could not find the shadow JAR file in fabric/build/libs/"
81+
exit 1
82+
fi
83+
JAR_FILENAME=$(basename "$JAR_PATH")
84+
echo "Found JAR path: $JAR_PATH"
85+
echo "Found JAR filename: $JAR_FILENAME"
86+
echo "path=$JAR_PATH" >> $GITHUB_OUTPUT
87+
echo "filename=$JAR_FILENAME" >> $GITHUB_OUTPUT
88+
shell: bash
89+
90+
# 8. Upload the Bukkit Shadow Jar as a release asset
7291
- name: Upload Bukkit Release Asset
7392
uses: svenstaro/upload-release-action@v2
7493
with:
@@ -78,12 +97,22 @@ jobs:
7897
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
7998
overwrite: true # Optional: Replace asset with the same name if it already exists
8099

81-
# 8. Upload the Velocity Shadow Jar as a release asset
100+
# 9. Upload the Velocity Shadow Jar as a release asset
82101
- name: Upload Velocity Release Asset
83102
uses: svenstaro/upload-release-action@v2
84103
with:
85104
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
86105
file: ${{ steps.find_velocity_jar.outputs.path }} # The path to the JAR found in the previous step
87106
asset_name: ${{ steps.find_velocity_jar.outputs.filename }} # Use the filename extracted earlier
88107
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
108+
overwrite: true # Optional: Replace asset with the same name if it already exists
109+
110+
# 10. Upload the Fabric Jar as a release asset
111+
- name: Upload Fabric Release Asset
112+
uses: svenstaro/upload-release-action@v2
113+
with:
114+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions automatically
115+
file: ${{ steps.find_fabric_jar.outputs.path }} # The path to the JAR found in the previous step
116+
asset_name: ${{ steps.find_fabric_jar.outputs.filename }} # Use the filename extracted earlier
117+
tag: ${{ github.ref }} # The git tag associated with the release that triggered the workflow
89118
overwrite: true # Optional: Replace asset with the same name if it already exists

0 commit comments

Comments
 (0)