55 branches :
66 - master
77
8- # Resolve Node.js 20 deprecation warnings by opting into the Node 24 runner
8+ # Suppress Node.js 20 deprecation warnings by explicitly opting into Node 24
99env :
1010 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
1111
@@ -16,50 +16,68 @@ jobs:
1616 steps :
1717 - name : 📦 Checkout Code
1818 uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0 # Required to generate a changelog from git history
1921
2022 - name : ☕ Set up Java 21
2123 uses : actions/setup-java@v4
2224 with :
2325 distribution : ' temurin'
2426 java-version : ' 21'
25- cache : ' maven' # Speeds up builds by caching dependencies
27+ cache : ' maven'
2628
2729 - name : 🏷 Get and Clean Version from pom.xml
2830 id : version
2931 run : |
30- # 1. Extract the raw version (e.g., 1.4.7-DEVBUILD.4 or 1.4.7)
3132 RAW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
32-
33- # 2. Cleaning logic: strip everything after the first hyphen
34- # This converts "1.4.7-DEVBUILD.4" -> "1.4.7"
3533 CLEAN_VERSION=$(echo $RAW_VERSION | cut -d'-' -f1)
36-
3734 echo "VERSION=$CLEAN_VERSION" >> $GITHUB_ENV
3835 echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT
39- echo "✅ Detected Raw: $RAW_VERSION -> Cleaned for Release: $CLEAN_VERSION"
36+
37+ - name : 📝 Generate Changelog
38+ id : changelog
39+ run : |
40+ # Gets commits between the last two tags, or all commits if no tags exist
41+ # Formats as: hash message - author
42+ CHANGELOG=$(git log --pretty=format:"%h %s - %an" -n 10)
43+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
44+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
45+ echo "EOF" >> $GITHUB_OUTPUT
4046
4147 - name : 🛠 Build Production JAR
4248 run : |
43- # Use -Drevision to force the clean version into the final JAR name
44- echo "Building Release version: ${{ env.VERSION }}"
4549 mvn clean package -Drevision=${{ env.VERSION }}
4650
4751 - name : 📦 Prepare Release Artifacts
4852 run : |
4953 mkdir -p dist
50- # Find the JAR matching the clean version
5154 JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1)
52-
5355 if [ -z "$JAR" ]; then
54- echo "❌ Expected JAR target/AutoPickup-${{ env.VERSION }}.jar not found"
55- ls -l target
56+ echo "❌ JAR not found"
5657 exit 1
5758 fi
58-
5959 cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar"
6060
61- - name : 📥 Upload Release Artifact
61+ - name : 📥 Upload to Modrinth
62+ uses : modrinth/minotaur@v3
63+ with :
64+ token : ${{ secrets.MODRINTH_TOKEN }} # You must add this to GitHub Secrets
65+ project-id : " oB3hT7d7" # Replace with your Modrinth Project ID or Slug
66+ version-number : ${{ env.VERSION }}
67+ version-name : " AutoPickup ${{ env.VERSION }}"
68+ version-type : " release"
69+ changelog : ${{ steps.changelog.outputs.changelog }}
70+ loaders : |
71+ paper
72+ purpur
73+ spigot
74+ game-versions : |
75+ 1.21
76+ 1.21.1
77+ files : dist/*.jar
78+
79+ - name : 📥 Upload Artifact to GitHub
6280 uses : actions/upload-artifact@v4
6381 with :
64- name : AutoPickup-${{ env.VERSION }}-RELEASE
82+ name : AutoPickup-${{ env.VERSION }}
6583 path : dist/*.jar
0 commit comments