1212 build :
1313 runs-on : ubuntu-latest
1414 outputs :
15- jar_file : ${{ steps.build.outputs.jar_file }}
15+ jar_name : ${{ steps.build.outputs.jar_name }}
1616
1717 steps :
1818 - name : Checkout
3131 chmod +x ./gradlew
3232 ./gradlew build
3333
34- JAR=$(ls build/libs/*.jar | grep -v sources | head -1)
35- echo "jar_file=$JAR" >> $GITHUB_OUTPUT
34+ JAR=$(find build/libs -maxdepth 1 -type f -name "*.jar" ! -name "*sources*" ! -name "*dev*" | head -n 1)
35+
36+ echo "Found JAR: $JAR"
37+ echo "jar_name=$(basename "$JAR")" >> $GITHUB_OUTPUT
38+
39+ - name : Upload JAR as artifact
40+ uses : actions/upload-artifact@v4
41+ with :
42+ name : mod-jar
43+ path : build/libs/${{ steps.build.outputs.jar_name }}
3644
3745 release :
3846 needs : build
4957 run : |
5058 TAG="${GITHUB_REF_NAME}"
5159
52- # Extract the section for this version
5360 BODY=$(awk "/^## $TAG/{flag=1;next}/^## /{flag=0}flag" CHANGELOG.md)
5461
55- # Fallback if there's no entry
5662 if [ -z "$BODY" ]; then
5763 BODY="No changelog entry found for $TAG."
5864 fi
@@ -71,12 +77,18 @@ jobs:
7177 env :
7278 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7379
80+ - name : Download built jar
81+ uses : actions/download-artifact@v4
82+ with :
83+ name : mod-jar
84+ path : dist
85+
7486 - name : Upload Release Asset
7587 uses : actions/upload-release-asset@v1
7688 env :
7789 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7890 with :
7991 upload_url : ${{ steps.create_release.outputs.upload_url }}
80- asset_path : ${{ needs.build.outputs.jar_file }}
81- asset_name : $(basename $ {{ needs.build.outputs.jar_file }})
92+ asset_path : dist/ ${{ needs.build.outputs.jar_name }}
93+ asset_name : ${{ needs.build.outputs.jar_name }}
8294 asset_content_type : application/java-archive
0 commit comments