Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Dev Build

on:
push:
branches:
- dev

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 📦 Checkout Code
uses: actions/checkout@v3

- name: ☕ Set up Java 21
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21

- name: 🏷 Get current base version from pom.xml
id: version
run: |
BASE_VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)
echo "BASE_VERSION=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_ENV
echo "base_version=${BASE_VERSION%%-DEVBUILD*}" >> $GITHUB_OUTPUT

- name: 🔢 Get last dev build number
id: get-devbuild
run: |
VERSION_FILE=".github/devbuild-count.txt"
VERSION="${{ steps.version.outputs.base_version }}"
mkdir -p .github
touch "$VERSION_FILE"

CURRENT=$(grep "^$VERSION=" "$VERSION_FILE" | cut -d= -f2)
if [ -z "$CURRENT" ]; then
CURRENT=1
else
CURRENT=$((CURRENT + 1))
fi

echo "$VERSION=$CURRENT" > "$VERSION_FILE"
echo "DEVBUILD=$CURRENT" >> $GITHUB_ENV
echo "build_num=$CURRENT" >> $GITHUB_OUTPUT

- name: 🛠 Build with Maven
run: |
VERSION="${{ env.BASE_VERSION }}-DEVBUILD.${{ steps.get-devbuild.outputs.build_num }}"
echo "Building version: $VERSION"
mvn clean package -Drevision=$VERSION

- name: 📦 Rename and move JAR to dist/
run: |
mkdir -p dist
JAR=$(find target -name "AutoPickup-*.jar" ! -name "*-original.jar" | head -n1)

if [ -z "$JAR" ]; then
echo "❌ No JAR found in target/"
ls -l target
exit 1
fi

cp "$JAR" "dist/AutoPickup-${{ env.BASE_VERSION }}-DEVBUILD.${{ steps.get-devbuild.outputs.build_num }}.jar"


- name: 📥 Upload Dev Build Artifact
uses: actions/upload-artifact@v4
with:
name: AutoPickup-${{ env.BASE_VERSION }}-DEVBUILD.${{ steps.get-devbuild.outputs.build_num }}
path: dist/*.jar
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

<groupId>us.thezircon.play</groupId>
<artifactId>AutoPickup</artifactId>
<version>1.4.7-DEVBUILD.4</version>
<version>${revision}</version>
<packaging>jar</packaging>

<name>AutoPickup</name>

<description>Automatically picks up the blocks you mine!</description>
<properties>
<revision>1.4.7-DEVBUILD.4</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>https://discord.gg/ncHH4FP</url>
Expand Down Expand Up @@ -120,4 +121,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>