From a8900ae9e476a6ac77e9831a174e51fe841f0210 Mon Sep 17 00:00:00 2001 From: BUTTERFIELD8 Date: Tue, 31 Mar 2026 18:43:12 -0400 Subject: [PATCH 1/2] Change workflow from Dev Build to Release Build Updated workflow to change from Dev Build to Release Build, modifying version handling and artifact naming. --- .github/workflows/release.yml | 45 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7319e4b..9eea30a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ -name: Dev Build +name: Release Build on: push: branches: - - dev + - master -# Opt into Node.js 24 for all actions in this workflow to resolve deprecation warnings +# Resolve Node.js 20 deprecation warnings by opting into the Node 24 runner env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -22,43 +22,44 @@ jobs: with: distribution: 'temurin' java-version: '21' - cache: 'maven' + cache: 'maven' # Speeds up builds by caching dependencies - - name: 🏷 Get and Clean Base Version + - name: 🏷 Get and Clean Version from pom.xml id: version run: | - # 1. Get raw version from pom (e.g., 1.4.7 or 1.4.7-DEVBUILD.4) + # 1. Extract the raw version (e.g., 1.4.7-DEVBUILD.4 or 1.4.7) RAW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - # 2. Strip any existing tags to get the clean base (e.g., 1.4.7) + # 2. Cleaning logic: strip everything after the first hyphen + # This converts "1.4.7-DEVBUILD.4" -> "1.4.7" CLEAN_VERSION=$(echo $RAW_VERSION | cut -d'-' -f1) - # 3. Create the new Dev version using GitHub's built-in run number - DEV_VERSION="${CLEAN_VERSION}-DEVBUILD.${{ github.run_number }}" - - echo "BASE_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV - echo "FINAL_VERSION=$DEV_VERSION" >> $GITHUB_ENV - echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT + echo "VERSION=$CLEAN_VERSION" >> $GITHUB_ENV + echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT + echo "✅ Detected Raw: $RAW_VERSION -> Cleaned for Release: $CLEAN_VERSION" - - name: 🛠 Build with Maven + - name: 🛠 Build Production JAR run: | - echo "Building Development version: ${{ env.FINAL_VERSION }}" - mvn clean package -Drevision=${{ env.FINAL_VERSION }} + # Use -Drevision to force the clean version into the final JAR name + echo "Building Release version: ${{ env.VERSION }}" + mvn clean package -Drevision=${{ env.VERSION }} - - name: 📦 Prepare Dev Artifacts + - name: 📦 Prepare Release Artifacts run: | mkdir -p dist - JAR=$(find target -name "AutoPickup-${{ env.FINAL_VERSION }}.jar" | head -n1) + # Find the JAR matching the clean version + JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1) if [ -z "$JAR" ]; then - echo "❌ No JAR found for version ${{ env.FINAL_VERSION }}" + echo "❌ Expected JAR target/AutoPickup-${{ env.VERSION }}.jar not found" + ls -l target exit 1 fi - cp "$JAR" "dist/AutoPickup-${{ env.FINAL_VERSION }}.jar" + cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar" - - name: 📥 Upload Dev Build Artifact + - name: 📥 Upload Release Artifact uses: actions/upload-artifact@v4 with: - name: AutoPickup-${{ env.FINAL_VERSION }} + name: AutoPickup-${{ env.VERSION }}-RELEASE path: dist/*.jar From bc7fbd1a42d64df4c6e30144d75598202be31825 Mon Sep 17 00:00:00 2001 From: BUTTERFIELD8 Date: Tue, 31 Mar 2026 18:52:02 -0400 Subject: [PATCH 2/2] CI/CD Now uploads to modrinth Updated release workflow to suppress Node.js 20 deprecation warnings and added changelog generation step. --- .github/workflows/release.yml | 52 +++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9eea30a..48d013f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: branches: - master -# Resolve Node.js 20 deprecation warnings by opting into the Node 24 runner +# Suppress Node.js 20 deprecation warnings by explicitly opting into Node 24 env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true @@ -16,50 +16,68 @@ jobs: steps: - name: 📦 Checkout Code uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required to generate a changelog from git history - name: ☕ Set up Java 21 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - cache: 'maven' # Speeds up builds by caching dependencies + cache: 'maven' - name: 🏷 Get and Clean Version from pom.xml id: version run: | - # 1. Extract the raw version (e.g., 1.4.7-DEVBUILD.4 or 1.4.7) RAW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - - # 2. Cleaning logic: strip everything after the first hyphen - # This converts "1.4.7-DEVBUILD.4" -> "1.4.7" CLEAN_VERSION=$(echo $RAW_VERSION | cut -d'-' -f1) - echo "VERSION=$CLEAN_VERSION" >> $GITHUB_ENV echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT - echo "✅ Detected Raw: $RAW_VERSION -> Cleaned for Release: $CLEAN_VERSION" + + - name: 📝 Generate Changelog + id: changelog + run: | + # Gets commits between the last two tags, or all commits if no tags exist + # Formats as: hash message - author + CHANGELOG=$(git log --pretty=format:"%h %s - %an" -n 10) + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - name: 🛠 Build Production JAR run: | - # Use -Drevision to force the clean version into the final JAR name - echo "Building Release version: ${{ env.VERSION }}" mvn clean package -Drevision=${{ env.VERSION }} - name: 📦 Prepare Release Artifacts run: | mkdir -p dist - # Find the JAR matching the clean version JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1) - if [ -z "$JAR" ]; then - echo "❌ Expected JAR target/AutoPickup-${{ env.VERSION }}.jar not found" - ls -l target + echo "❌ JAR not found" exit 1 fi - cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar" - - name: 📥 Upload Release Artifact + - name: 📥 Upload to Modrinth + uses: modrinth/minotaur@v3 + with: + token: ${{ secrets.MODRINTH_TOKEN }} # You must add this to GitHub Secrets + project-id: "oB3hT7d7" # Replace with your Modrinth Project ID or Slug + version-number: ${{ env.VERSION }} + version-name: "AutoPickup ${{ env.VERSION }}" + version-type: "release" + changelog: ${{ steps.changelog.outputs.changelog }} + loaders: | + paper + purpur + spigot + game-versions: | + 1.21 + 1.21.1 + files: dist/*.jar + + - name: 📥 Upload Artifact to GitHub uses: actions/upload-artifact@v4 with: - name: AutoPickup-${{ env.VERSION }}-RELEASE + name: AutoPickup-${{ env.VERSION }} path: dist/*.jar