1- name : Build All Versions
1+ name : Build and Auto-Release
22
33on :
44 push :
88 workflow_dispatch :
99
1010jobs :
11- build-all :
11+ build-and-release :
1212 runs-on : ubuntu-latest
13+ permissions :
14+ contents : write
1315
1416 steps :
1517 - uses : actions/checkout@v4
@@ -34,28 +36,73 @@ jobs:
3436
3537 echo "Build completed!"
3638
37- - name : Collect built JARs
39+ - name : Collect and rename built JARs
3840 run : |
3941 mkdir -p all-builds
4042
41- # Find all built JAR files from version subdirectories
42- find . -path "*/build/libs/*.jar" -type f | while read jar; do
43- echo "Found: $jar"
44- cp "$jar" all-builds/
43+ # Find all built JAR files and rename them with version
44+ for dir in versions/*/; do
45+ if [ -d "$dir/build/libs" ]; then
46+ VERSION=$(basename "$dir")
47+
48+ # Copy and rename main JAR only
49+ if [ -f "$dir/build/libs/greentext-1.0.0.jar" ]; then
50+ cp "$dir/build/libs/greentext-1.0.0.jar" "all-builds/greentext-1.0.0-mc$VERSION.jar"
51+ echo "Copied: greentext-1.0.0-mc$VERSION.jar"
52+ fi
53+ fi
4554 done
4655
47- echo "========================================="
48- echo "Build Summary"
49- echo "========================================="
5056 echo "JAR files collected: $(ls -1 all-builds/*.jar 2>/dev/null | wc -l)"
51- echo ""
52- echo "Built files:"
53- ls -la all-builds/*.jar 2>/dev/null || echo "No JAR files found"
5457
55- - name : Upload all builds
58+ - name : Upload artifacts
5659 uses : actions/upload-artifact@v4
5760 with :
5861 name : GreenTextMod-all-versions
5962 path : all-builds/*.jar
6063 if-no-files-found : warn
61- retention-days : 30
64+ retention-days : 30
65+
66+ # Auto-release on main branch only
67+ - name : Delete old latest release
68+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
69+ uses :
dev-drprasad/[email protected] 70+ with :
71+ tag_name : latest
72+ github_token : ${{ secrets.GITHUB_TOKEN }}
73+ continue-on-error : true
74+
75+ - name : Create Latest Release
76+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
77+ uses : ncipollo/release-action@v1
78+ with :
79+ tag : latest
80+ name : Latest Build
81+ body : |
82+ # GreenText Mod - Latest Build
83+
84+ **Build Date:** ${{ github.event.head_commit.timestamp }}
85+ **Commit:** ${{ github.sha }}
86+
87+ ## Available Minecraft Versions
88+
89+ This build includes support for Minecraft versions from 1.16 to 1.21.8
90+
91+ ## Installation
92+
93+ 1. Download the JAR file for your Minecraft version
94+ 2. Place it in your `mods` folder
95+ 3. Make sure you have Fabric Loader installed
96+
97+ ## Features
98+
99+ - Messages starting with `>` will appear in green text
100+ - Works in both client and server chat
101+
102+ ---
103+ *This is an automated build from the latest commit*
104+ artifacts : " all-builds/*.jar"
105+ allowUpdates : true
106+ removeArtifacts : true
107+ makeLatest : true
108+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments